Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is the easiest way to get Window handle value?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00051377
Message ID:
00052082
Vues:
63
>George,
>
>That's the problem....Maybe I didn't make myself clear on that point...
>
>If you define two windows and get the correct handle # for the first
>while positioned in the second, SetFocus(hWnd1) will not reset the
>focus....
>
>This can all be done from the command window (or 2 small .prg files)
>after the Declares for the Win32 API calls....
>
>It looks like a bug to me....:)
>
>Thanks for double checking....I thought I was going nuts....
>
>Jon

Jon,

I'm no longer exactly sure of what it is that you're trying to do, get a window handle for the child or programmatically change the focus. Under the assumption that it's the latter, here's a solution.

You're right about using the SetFocus API call. I've been able to change the focus of a window using it. Here's how:

I dropped a FoxHWnd control on the form. In the form's activate event I assigned the HWnd property to an element in a global array. I created an identical form and did the same thing, simply changing the element number. In the click event of the command button on each form, I called the SetFocus API call, using the element of the array that applied to the other form. I'm sure you get the idea of how to apply this.

As a side note, I previously tried retrieving the window handle using the GetTopWindow API call in the form's Activate event. Surprisingly, the window handles for the two elements of the array were identical. I'd like someone to explain that one to me.

I hope that this will help you solve your problem.

George
George

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

Click here to load this message in the networking platform