Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting the Current App Handle
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00148855
Message ID:
00148908
Views:
18
>Greetings All,
>
>I have an application that starts other applications outside of VFP. How can I determine what the handle of the Active Window. GetActiveWindow seems to return the VFP handle, I need the handle of the currently active app.
>
>
>Example: I start my VFP app, which in turn kicks of a Seafood Ordering Application. I can get the handle of this application. Lets say I then start up MS-Mail and this is now on top, how would I get this handle? Then when I return to my Seafood App, I would need to get the Active Handle of the top window again.
>
>Thanks in Advance.
>
Hi Scott,

If the application has a static window handle you can use the FindWindow() API call:
DECLARE INTEGER FindWindow IN Win32API;
  STRING @lpclassname, STRING @lptitle
* lctitle is the apps title text bar
lnhWnd = FindWindow(0, @lctitle)
If lnhWnd equals zero, the window doesn't exsist. However, the title bar must match *exactly*.

Try downloading my Is_Run32 program from the Win32 and other APIs download section. It will retrieve the window handle based on the known portion of the title bar.

hth,
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform