Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SetForegroundWindow behavior frustrating
Message
From
09/05/2003 04:17:12
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00786521
Message ID:
00786656
Views:
46
Hi Sergey,
While it'd work it's forcing behaviour like previous windows versions as stated in SetForeGround documentation and they don't suggest it to do w/o notifying the user. Suggested workaround (and works quite well) :
*..
lpdwProcessId = 0
lnThreadVFP = GetCurrentThreadID()
lnThread2 = GetWindowThreadProcessId(GetForegroundWindow(), @lpdwProcessId)
if ( lnThreadVFP # lnThread2 )
 AttachThreadInput(lnThreadVFP, lnThread2, 1)
 SetForegroundWindow(VFPwindowhandle)
 AttachThreadInput(lnThreadVFP, lnThread2, 0)
else
 SetForegroundWindow(VFPwindowhandle)
endif
Cetin

>Larry,
>
>See if following registry tweak could help http://www.winguides.com/registry/display.php/540/
>
>>I have an application that runs as the only user-available application (kind of like a kiosk). When the user logs in to the network, my VFP application starts up via a shortcut in the Startup group. The problem is that there is some background task running that takes the focus away from the VFP app. Since our application is using a keyboard wedge-connected barcode scanner we need to keep the application in the foreground or the simulated keystrokes get sent to the desktop or anywhere other than our VFP app.
>>
>>I thought I would just issue a SetForegroundWindow API call every second or so. The problem is that instead of bringing itself to the front and activating the window it merely makes the taskbar icon for the app flash. Now, this seems to agree with the documentation for this API call in the MSDN articles I have read but that's not what I want. The users of this app rarely ever use a mouse so I want to avoid the necessity of telling them to click on my form (or the taskbar icon) if the barcode data doesn't show up in the field.
>>
>>I am running on Windows XP Pro. Any help would be appreciated.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform