>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.