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 --- _______________________________________________ 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/edcf902b-5506-4043-a70b-6ef032e3d...@wollenhaupt.org ** 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.