Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FindWindow
Message
From
03/01/1999 20:43:15
 
 
To
03/01/1999 18:16:15
Calvin Smith
Wayne Reaves Computer Systems
Macon, Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00172288
Message ID:
00172300
Views:
36
>Here's what I want to do. When my app is starting the _screen.caption is 'Starting Program'. During the initial startup I want to use a API function to see if the app is already running. If it is, I want to give the user the chance to switch to the already running version or actually start another session. If he wants to start another session, I then change the screen caption to the true app name. The problem- I cannot get what I think is the correct API function FindWindow to function within VFP. If I type: 'Declare integer FindWindow in Win32api string string' and then try to use the function by typeing 'FindWindow('',AppName)' it always returns 0 or tells me I have an incorrect number of paramters. I am new to using Win32 from within FoxPro but I have something similiar in Delphi and it seems to work there.
>
>Can I do what I want to do from within VFP, am I using the wrong API function or What ?

You've got the right idea, but are passing the wrong thing. Try
DECLARE INTEGER FindWindow IN WIN32API STRING cClass, STRING cWindow
nHWND = FindWindow(0,cAppStringToFind)
It's important to pass a 0, which is equivalent to a null pointer, for the first argument, rather than a pointer to a null strin, which has an actual address associated with it.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform