Hi Christof

Many, many thanks for your reply.  It looks like just what I need and I will
try it out later today.  

In the meantime I have come up with a different approach for the time being.
I have created a form with an RTF OLE control and an edit box.  I run the
form using CTRL+F10.  In my editing window I use CTRL+A, CTRL+C.  Pressing
CTRL+F10 brings up my form and in the RTL OLE control I press CTRL+V.

In the Change method/event of the RTF control I set the value of the edit
box to the TextRTF property of the control.

BTW - ISX - Is that InstallShield Express?

Thanks again

Paul

-----Original Message-----
From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of Christof
Wollenhaupt
Sent: 07 February 2022 06:43
To: profoxt...@leafe.com
Subject: Re: Copy contents of code/editor window with formatting

Hi Paul,

> 1.    I want it to work with the current/open editing window

in ISX I use the following code:

    *-----------------------------------------------------------------
    * Get the current window and verify that it is a valid window.
    *-----------------------------------------------------------------
    Local lnWHandle
    lnWHandle = GetCurrentWindow()
    If lnWHandle == 0
        If not Empty(m.tcInvocation)
            Clear TypeAhead
            Keyboard "{Mouse}{Mouse}"+m.tcInvocation Plain
        Endif
        Return
    Endif

    *-----------------------------------------------------------------
    * Verify that the current window is indeed an edit window.
    *-----------------------------------------------------------------
    Local lnEditSource 
    lnEditSource = GetEditSource(m.lnWHandle)
    If not InList( m.lnEditSource, 1, 8, 10, 12 )
        If not Empty(m.tcInvocation)
            Clear TypeAhead
            Keyboard "{Mouse}{Mouse}"+m.tcInvocation Plain
        Endif
        Return
    EndIf

*====================================================================
* Determines the source of the window identified by the passed 
* WHandle. It returns the following values:
*
* -1     The window is not an edit window
*  0     Command Window
*  1     MODIFY COMMAND window
*  2     MODIFY FILE window
*  8     Menu Designer code window
* 10     Method Edit Window in Class or Form Designer
* 12     MODIFY PROCEDURE window
*
* This procedure uses _EdGetEnv() from the FoxTools.Fll to determine
* the edit source. Passing an invalid handle causes an exception in
* VFP 5 and VFP 3. In VFP 6 this raises an error 2028 (API function
* caused an exception). Therefore we return -1 in this case, too.
*====================================================================
Procedure GetEditSource
LParameter tnWHandle

    Local laEnv[25], lnSource, lnOK, lcError
    lcError = On( "Error" )
    On Error lnOK = 0
    lnOK = _EdGetEnv( m.tnWHandle, @laEnv )
    On Error &lcError
    If m.lnOK == 0
        lnSource = -1
    Else
        lnSource = laEnv[25]
    Endif
    
Return m.lnSource


*====================================================================
* Returns the WHandle of the current edit window or 0, if no edit
* window is available.
*====================================================================
Procedure GetCurrentWindow

    Local lnWindowOnTop
    lnWindowOnTop = _WOnTop()
    If m.lnWindowOnTop <= 0
        Return 0
    Endif
    If GetEditSource( m.lnWindowOnTop ) == -1
        lnWindowOnTop = 0
    Endif
    
Return m.lnWindowOnTop


-- 
Christof



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/006601d81c2f$9c17dd80$d4479880$@gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to