Window detection? 
Author Message
 Window detection?

Hi.

It is possible for a VFP application to detect if another program is running
and the current state of its window (minimized, maximized) ? How?

Thank you..!

Alex.



Mon, 05 Sep 2005 22:05:20 GMT  
 Window detection?
Alex

This will tell you if your app is running or not, not sure about the window
state bit but this should put your on the right track
API calls unfortunatley but with some toying sure it will do what you want.

Regards
Dave

&&& Check to see if application is already running
&& declare api calls

DECLARE INTEGER GetActiveWindow ;
  IN Win32API
DECLARE INTEGER GetWindow IN Win32API ;
  INTEGER hWnd, INTEGER nType
DECLARE INTEGER GetWindowText IN Win32API ;

DECLARE INTEGER BringWindowToTop IN Win32API ;
  INTEGER hWnd

lnHand = IsRunning("MY APPLICATION NAME HERE")
IF lnHand = 0
ELSE
   BringWindowToTop(lnHand)
 ON error
 cancel
ENDIF

&&& Isrunning function
FUNCTION IsRunning
  LPARAMETER tcTitle
  hNext = GetActiveWindow()
 * iterate through the open windows
  DO WHILE hNext<>0
    cText = REPLICATE(CHR(0),80)

    IF UPPER(ALLTRIM(tcTitle))$ALLTRIM(cText)
      * parameter text is present in window title
      RETURN hNext
     ENDIF
     hNext = GetWindow(hNext,2)            && next window
  ENDDO
  * required window not found
  RETURN 0
ENDFUNC



Mon, 05 Sep 2005 22:21:03 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Instances Detection

2. DETECTION OF AN OPEN FORM

3. CDROM drive detection

4. Foxpro 2.5 & Error Detection Q's

5. mouse detection

6. HELP FPW26.WIN95, Modem detection

7. Ring Detection FoxPro2.5

8. Row Change Detection

9. Event detection

10. Show Window / Hide Window / Zoom Window problems

11. Activity detection. Any modem experts?

12. VFP 3.0 Grid RecordMark 'selector column' detection ??

 

 
Powered by phpBB® Forum Software