Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP Apps Always takes Focus - Can this be changed?
Message
From
25/04/2008 16:51:19
 
 
To
25/04/2008 16:40:44
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows NT
Database:
MS SQL Server
Miscellaneous
Thread ID:
01312973
Message ID:
01313208
Views:
31
No, I didn't get that. I use it for launching 3rd party apps in the background from VFP9. I'm not sure I understand what you are doing. If you have one vfp app running, and another vfp app that launches programs and the 2nd vfp app that launches programs is stealing the focus from the 1st vfp app, is that what you meant?


>Tracy,
>
>I probably didn't make myself as clear as I could have. Each of my PRGS is launched by a scheduling program called "JIT.EXE" with the line of:
>
>
>C:\VFP9\vfp9.exe" -t -cC:\VFP\Silent.fpw "DeleteFileOnReboot.prg
>
>
>So, each PRG launches a copy of VFP9. I don't see how the API could help me, unless I was launching each of the PRGS from a master VFP9 application. Right?
>
>Thanks,
>Robert
>
>>Try something like:
>
>
>STORE ADLLS(dllArray) TO lnNumDLLs
>IF ASCAN(dllArray,"GetActiveWindow") = 0
>      DECLARE INTEGER GetActiveWindow IN User32 INTEGER
>ENDIF
>IF ASCAN(dllArray,"SetForegroundWindow") = 0
>      DECLARE INTEGER SetForegroundWindow IN User32 INTEGER
>ENDIF
>
>*--Get the current calling program's window
>IF TYPE('gnMainFoxWin') <> "N" .or. gnMainFoxWin = 0
>      gnMainFoxWin=GetActiveWindow()
>ENDIF
>
>*--Run your prg that shifts focus
>*--Note you might need a doevents after or a method of waiting for the focus
>*--to shift so you can bring it back (don't call setforegroundwindow too
>*--soon)
>*--Experiment with a DOEVENTS FORCE force here if you run into problems
>*--but try it first without it
>
>*--Bring focus back to the calling program
>IF TYPE('gnFoxMainWin') = "N" AND gnFoxMainWin <> 0
>      =SetForegroundWindow(gnMainFoxWin)
>ENDIF
>DOEVENTS FORCE
>
>
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform