Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How we can get a handle to vfp's form?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00284241
Message ID:
00285152
Vues:
23
>>But how to do it if the form is a VFP5 one with no caption. The reason I ask this is that in another VB program I could move a Titleless form(similar to a splash screen with no close, zoom etc and NO Title) using Win API as VB had a built in Fn to give the handle of the form.
>>
>>So it must be possible in the API to get a handle of the form (not _screen) but how, without the Title(Caption)??
>>
>Hi Bernard,
>
>Steven Ruhl's GetFocus() API call might do this for you. However, the approach I would use might be a bit different than you'd expect. I'd create a custom property, say nhWnd and assign it a 0 value. In the form's GotFocus event, I'd check to see if it were empty, and if so, call GetFocus() and assign the property's value that way. A disclaimer here, however, I only tested this in VFP 6.0 (don't have access to 5.0 any longer). In 6.0, a form can be without a title bar, but still have a caption. I have no way to determine if that will impact the above.
>
>Please let me know if this works.


George you beauty!

GetFocus() works exactly like it should and even on a Captionless Form.

This will interest you though you may have heard of this method before.

Problem
Q:How to allow moving a captionless form in VFP5??
A: Use the windows API as such:

In the MouseDown event of the Captionless, Controlboxless (like a splash screen)
form add this code

*Courtesy George Tasker
DECLARE INTEGER GetFocus IN WIN32API

* other
DECLARE INTEGER ReleaseCapture IN WIN32API
DECLARE INTEGER SendMessage IN WIN32API INTEGER, INTEGER, INTEGER, INTEGER

* get the handle of the current focussed window
bbhwnd=GETFOCUS()

bb001A = 274
bb001b = -4078

If nButton = 1 Then
bb=ReleaseCapture()
bb=SendMessage(bbhwnd, bb001A, bb001B, 0)
EndIf

Now run the form, click and MOVE it.

Thanks George
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform