Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set focus to the executable
Message
 
 
À
17/02/2010 13:14:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01449446
Message ID:
01449465
Vues:
36
Put the code as it was in a message in your main.prg.

From the main form Activate method try

ActivateWindow(thisform.hwnd)

I'm not 100% certain is needs to be called from form's Activate, but try it this way first.

>>>>>Hello! i have a program from which i build an executable. the thing is...when i run the executable..i have to click it before i can enter my username and password. i tried
>>>>>
>>>>>thisform.username.setfocus()
>>>>>
>>>>>but that doesnt activate the form or set the focus..i must click it first any idea?S:(
>>>>
>>>>Check Re: How to get focus to my VFP app from a VFP utility once c Thread #1220775 Message #1220782
>>>>
>>>>Pass hwnd of your main form to this function.
>>>
>>>
>>>WOW!im a novice u know. that code scared me
>>
>>Don't be too scared - copy it, put in a function in your main program and then call from form's activate, for example.
>That code doesnt work for me...
>when i try to save says somethin like "MEthods and events cant contain nested procedures" u mind telling me that it says thou
>
>procedure ActivateWindow
>	lparameters tnHwnd
>	declare short SetForegroundWindow in win32API integer nHwnd
>	declare short ShowWindow in WIN32API alias Win32ShowWindow ;
>		integer hwnd, ;
>		integer nCmdShow
>	declare short GetWindowPlacement in WIN32API ;
>		integer hwnd, ;
>		string @ lpwndpl
>
>	#define SW_SHOWMINIMIZED    2
>	#define SW_SHOWMAXIMIZED    3
>	#define SW_MAXIMIZE         3
>	#define SW_SHOWNOACTIVATE   4
>	#define SW_SHOW             5
>	#define SW_MINIMIZE         6
>	#define SW_SHOWMINNOACTIVE  7
>	#define SW_SHOWNA           8
>	#define SW_RESTORE          9
>	#define SW_SHOWDEFAULT      10
>	#define SW_FORCEMINIMIZE    11
>
>	local lnHWND, lpwndpl
>	lpwndpl = chr(4*3+8*2+4*4)+replicate(chr(0),4*3+8*2+4*4-1)
>	SetForegroundWindow( m.tnHWND )
>	if ( GetWindowPlacement(m.tnHWND, @lpwndpl) # 0 ) and ;
>			inlist(asc(substr(m.lpwndpl, 4+4+1, 1)), ;
>			SW_SHOWMINIMIZED, SW_MINIMIZE, SW_SHOWMINNOACTIVE, SW_FORCEMINIMIZE)
>		Win32ShowWindow(m.tnHWND, SW_RESTORE)
>	endif
>
>
>
>and pass hwnd to thisform as a function. im stumped here as well.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform