Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP Apps Always takes Focus - Can this be changed?
Message
 
 
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:
01313205
Views:
36
Hi Robert,

Again, what exactly is the problem? VFP blinking the first moment it tries to execute (stealing the focus for a moment from another open application)? Is it correct definition of the problem or there is something else?

>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
>
>
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform