Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get a window handle (hWnd)
Message
 
À
20/04/1998 05:59:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00093155
Message ID:
00093354
Vues:
29
>>>I'd like to know how to get a window handle (hWnd) in order to pass to Win32 API from VFP 5.0a.
>>>
>>>The below C-code is what I've been read from one of the thread:
>>>
>>>void GetObjectWHandle(ParamBlk *parm)
>>>{
>>> HWND hWnd;
>>> MHANDLE mhWnd;
>>>
>>> mhWnd=_WGetObjectWindow(&(parm->p[0].val));
>>> hWnd=_WhToHwnd(mhWnd);
>>> _RetInt((LONG)hWnd,8);
>>>}
>>>
>>>Then, what is the parameter type sould be specified in the FoxInfo ?
>>>
>>>FoxInfo myFoxInfo[] = {
>>> {"GETHWND",(FPFI) GetObjectWHandle, 1, "I"},
>>>};
>>>
>>>Once the .Fll have been created, what should I pass to it from a VFP form ?
>>>
>>>In Visual FoxPro:
>>>
>>>Set library to fll.fll
>>>hWnd=GETHWND(Thisform) && doesn't work, type miss match
>>>
>>>hWnd=GETHWND(_screen.activeform) && doesn't work. 'ACTIVEFORM' is not && an object
>>>
>>>Thanks in advance.
>>
>>I use three functions in to get this information. The main window can be retrieved using MainhWnd(). Forms use:
>>* Or ThisForm.Caption or a literal string
>>lnwhandle = _WFindTitl(_SCREEN.ActiveForm.Caption)
>>lnhWnd = _WhTohWnd(lnwhandle)
>>hth,
>
>Thanks for your response. It works, but the caption of form must be convert to uppercase.

I've never encountered this type of behavior, and testing indicates that the function is case sensitive. For example, using:
? _WFindTitl(_SCREEN.Caption) && Returns a value
? _WMainWind() && Same value as above
? _WFindTitl(UPPER(_SCREEN.Caption)) && Returns 0
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform