Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
One Exe
Message
From
16/07/2003 06:36:44
 
 
To
15/07/2003 23:50:22
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00810530
Message ID:
00810577
Views:
11
In the top-level-form of the application you can check if there is already a windows with the same caption. In the init-event I use this code for that purpose:
----------
Local wHandle, cCaption
Declare integer SetForegroundWindow in Win32Api integer
Declare integer FindWindow in Win32Api string, string
With this
cCaption = .caption
.caption = "Where is "+upper(cCaption)+"?"
wHandle = FindWindow(0,cCaption)
If wHandle > 0
SetForeGroundWindow(wHandle)
Quit
Endif
.caption = cCaption
wHandle = FindWindow(0,.caption)
SetForeGroundWindow(wHandle)
Endwith
----------
It's not foolproof! The code looks for a window with the same caption, so if there is a window that complies the assumption is that it is the application whereas it might be something completely different like an explorer-window showing a folder with the same name.
It works fine for me (VFP6 and VFP8 on Win95 .. WinXP).
Previous
Reply
Map
View

Click here to load this message in the networking platform