General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only