>>>I grab this sample in order to detect if an application is already running by checking at the window's title.
>>>
>>>FUNCTION CheckWin
>>>* Routine which sees if an application is active by looking for its
>>>* Window title
>>>* expC1 Window title
>>>PARAMETER tcTitle
>>>DECLARE INTEGER FindWindow in Win32API as FindWindow STRING, STRING
>>>RETURN IIF(FindWindow(0,tcTitle)>0,.T.,.F.)
>>>
>>>However, this is not good. I would like to detect for the task name instead.
>>>
>>>Anyone has an idea?
>>
>>Michel,
>>
>>Do you mean class name? The task list is pretty much a list of the title text.
>
>Yes, the class name.
This is a Catch-22. In order to get the class name, you need the window handle. Here's the declaration
DECLARE INTEGER GetClassName IN Win32API;
INTEGER hWnd, STRING @lpClassName, INTEGER nMaxCount
nMaxCount is the length of the lpClassName string.
Another note, all FoxPro windows have the same class name: Fox_4000001.
If I were to guess at the problem you're trying to solve, I'd say it was twofold. One, FindWindow only works if you have the exact title name, and it doesn't work on child windows. Two, you're trying to get the handle of a child window. Am I close?
George
George
Ubi caritas et amor, deus ibi est