>>Klas,
>>George is right. FindWindow gets 2 parameters, class and title. If any of the parameters you pass null, everything matches :
>>
>>FindWindow(Class,Title) && Check both match
>>FindWindow(0,Title) && Any class match
>>FindWindow(Class,0) && Any title match
>>FindWindow(0,0) && Any class and title match
>>
>>function fWin
>>lParameters tuClass, tuWinTitle
>>DECLARE integer FindWindow in WIN32API string cClass, string cWinName
>>hWnd = FindWindow(tuClass,tuWintitle)
>>clear dlls
>>return hWNd
>>
>>? fwin("Fox_4000001","Microsoft Visual FoxPro")
>>? fwin("Fox_4000001",0)
>>? fwin(0,"Microsoft Visual FoxPro")
>>? fwin(0,0)
>>
>>Here interesting thing with only one instance of VFP (development), fwin("Fox_4000001",0) and fwin(0,"Microsoft Visual FoxPro") return different values (where is the main fox window ?). And many VFP window with same title return only first.
>>
>>I would also test it for you in word if I knew how to write and test that in word.
>>Cetin
>
>Cetin,
>
>There was a thread some months ago where I tried to find a way to use FindWindow in Word to find out if VFP was running and the above was one of your answers.
>
>I still have not found a way to know if VFP is running from Word and I am using the following code in Word (very simple):
>
>
>Declare Function FindWindowA Lib "user32" (lpszClassName As String, lpszWindowName As String) As Long
>
>lnHandle = FindWindowA(0, "Microsoft Visual FoxPro")
Hi Klas,
Try passing the parameters by reference rather than value. That's what the "lp" in the declaration means.
George
Ubi caritas et amor, deus ibi est