Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
EXE forced in front of other EXE at runtime
Message
De
14/04/2015 13:08:50
 
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:
01618405
Vues:
46
>>
>>Hopefully you will find this program useful
>>*forceforeground.prg
>>Lparameters tnHWND
>>
>>Local lnAppThread As Number, ;
>>   lnForeThread As Number
>>Declare Long BringWindowToTop In Win32API Long
>>
>>Declare Long ShowWindow In Win32API Long, Long
>>
>>Declare Integer GetCurrentThreadId;
>>   In kernel32
>>
>>Declare Integer GetWindowThreadProcessId In user32;
>>   Integer   HWnd, ;
>>   Integer @ lpdwProcId
>>
>>Declare Integer GetCurrentThreadId;
>>   In kernel32
>>
>>Declare Integer AttachThreadInput In user32 ;
>>   Integer idAttach, ;
>>   Integer idAttachTo, ;
>>   Integer fAttach
>>
>>Declare Integer GetForegroundWindow In user32
>>
>>m.lnForeThread = GetWindowThreadProcessId(GetForegroundWindow(), 0)
>>m.lnAppThread = GetCurrentThreadId()
>>
>>If m.lnForeThread != m.lnAppThread
>>   AttachThreadInput(m.lnForeThread, m.lnAppThread, .T.)
>>   BringWindowToTop(m.tnHWND)
>>   ShowWindow(m.tnHWND, 3)
>>   AttachThreadInput(m.lnForeThread, m.lnAppThread, .F.)
>>Else
>>   BringWindowToTop(m.tnHWND)
>>   ShowWindow(m.tnHWND, 3)
>>Endif
>>
>>return
>
>I ran this code and it still won't let me put the EXE that is running as the current thread into the ForeGround of the screen. I am running under Windows 7 SP1 and I tested it also on windows XP to see if it works on the older operating system, but it did not work as expected there either.
>
>I am passing the Window Handle of the current thread over to the code by using Thisform.Hwnd. I have a timer which runs every 5 seconds to run the code above to push this EXE over any other exe running on the screen.
>
>I compiled the app as an EXE and ran it. When it runs, I have 2 instances of NOTEPAD.exe running, which I place on the screen also, When I place either of the Notepads over the running EXE, the running EXE form displays the Hwnds of the notepad and the running EXE (which are different and expected). But the code does not push the running EXE over the Notepad.
>
>So, I am at a loss again. Any suggestions or ideas ?? Thanks again for your help !

Sorry, I don't have any more ideas.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform