Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
EXE forced in front of other EXE at runtime
Message
 
À
15/04/2015 02:35:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01618033
Message ID:
01618454
Vues:
61
>>>>>>>>>>Hi Gang!
>>>>>>>>>>

(snip)

>
>
>There are a number of restrictions on SetForegroundWindow - see remarks here https://msdn.microsoft.com/en-us/library/windows/desktop/ms633539(v=vs.85).aspx
>
>I have this function - try it - don't know whether it will work for you
>
>
>
>function WindowToForeGround(handle)
>	=ShowWindow(m.Handle, SW_SHOW)
>	if( empty(SetForegroundWindow(m.handle)) )
>		=ShowWindow(m.handle, SW_SHOWMINIMIZED)
>		=ShowWindow(m.handle, SW_RESTORE)
>	endif
>endfunc
>
Here is the code I was using based on your code...
Function WindowToForeGround
LPARAMETERS handle
* Constants used with APIs
#DEFINE SW_SHOW  			5
#DEFINE SW_RESTORE  		9
#DEFINE SW_SHOWMINIMIZED	2

DECLARE INTEGER SetForegroundWindow IN user32 INTEGER hwnd
Declare Long ShowWindow In Win32API Long, Long

	=ShowWindow(Handle, SW_SHOW)
		FORM1.TXTOUTPUT.VALUE = form1.txtoutput.value + CHR(32) + 'Attempted the showwindow before the if endif'
		WAIT WINDOW "" TIMEOUT 3
	if( empty(SetForegroundWindow(handle)) )
		=ShowWindow(handle, SW_SHOWMINIMIZED)
		=ShowWindow(handle, SW_RESTORE)
		
		FORM1.TXTOUTPUT.VALUE = form1.txtoutput.value + CHR(32) + 'wE are in the foreground3 code in the if endif'
		WAIT WINDOW "" TIMEOUT 3
	endif
endfunc
Using this, I was able to see output directed to an output text window (which had no affect, since the behavior was the same with or without it).

When I ran this code from TEST program, and allowed a time to hit this code every 3 seconds for testing, the code would run this this new code without error.

When I pressed the NOTEPAD.exe program and made it show OVER part of the TEST program, when the code fired and tried to run the new code (IN the TEST program which was BEHIND the NOTEPAD.exe, the TEST program DID not come to the ForeGround, but rather started to FLASH the TEST icon in the Taskbar.

Not exactly what I was wanting.... (grin).

So..... anything else I can try ???

Thanks!
Tommy Tillman A+ NetWork+ MCP
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform