|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to monopolize Windows in vb6Hi all,
I am writing a small piece of app to automate a critical task. However, while this app is running, I can't have any other tasks getting the focus. How can I keep my app in focus in Windows, ie, monopolize it for a brief period of time in vb6? Thanks for sharing your thoughts. "Ben" <B**@discussions.microsoft.com> wrote in message Since "System Modal" went the way of the dinosaurs after Win3.1, about the news:E4B4D1A0-1241-4E70-80CA-4EC2A4D9C64C@microsoft.com... > Hi all, > > I am writing a small piece of app to automate a critical task. However, > while this app is running, I can't have any other tasks getting the > focus. > How can I keep my app in focus in Windows, ie, monopolize it for a brief > period of time in vb6? Thanks for sharing your thoughts. only way I've seen is to use something like this.... Creating New Desktops and Running Applications http://www.vbaccelerator.com/home/VB/Code/Libraries/Windows/Creating_New_Desktops/article.asp .....which creates an entirely new desktop for your app to run on. Alt-Tab and Ctrl-Alt-Del are of no use when your app's the only one running on the current desktop. There's no taskbar, start menu, etc for people to muck with either. You'll need to make double sure that your app has adequate error handling and you never allow it to close (no matter what) before returning control to the original desktop. The "Creating New Desktops" sample has specific uses/limitations and if the app doesn't fall into the "what can I do with my own desktop" category, you'll have to keep looking. -- Ken Halter - MS-MVP-VB - http://www.vbsight.com DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Please keep all discussions in the groups.. Hi,
You can use Ken's suggestion, which is a good one. Another alternative, especially if all you want to do is to make sure that your application has all of the available resources for SHORT periods of time (I judge short to be one or two seconds, but might accept a somewhat longer interval), you can use the Windows SetPriorityClass API to run your application with a REAL-TIME priority. Set this way, your app hogs almost all of Windows' compute resources. I have code examples under my PC Data Acquisition link. Click on Real-time, then select the 'Click here for some suggestions' link. Dick -- Richard Grier (Microsoft Visual Basic MVP) See www.hardandsoftware.net for contact information. Author of Visual Basic Programmer's Guide to Serial Communications, 4th Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See www.mabry.com/vbpgser4 to order. Ken,
-- Show quoteHide quoteKen, Dick - I am wondering, it it possible to use some API call to capture the windows handle and have my app "talk" to another window in the background? Basically, my app need to send and respond to a windows, but will this is running, other running apps may get the focus and this is my concern. But if there's a way for my app to capture the windows handle and "talk" directly to the app that may solve my problems. Any suggestions? Thanks again. Ben "Ben" wrote: > Hi all, > > I am writing a small piece of app to automate a critical task. However, > while this app is running, I can't have any other tasks getting the focus. > How can I keep my app in focus in Windows, ie, monopolize it for a brief > period of time in vb6? Thanks for sharing your thoughts. >
Show quote
Hide quote
"Ben" <B**@discussions.microsoft.com> wrote in message There are far too many variables in that question <g>. If you have the news:2E710AC1-389A-4F1E-A7C7-A9CCE1D92EA4@microsoft.com... > Ken, > -- > > Ken, Dick - > > I am wondering, it it possible to use some API call to capture the windows > handle and have my app "talk" to another window in the background? > Basically, my app need to send and respond to a windows, but will this is > running, other running apps may get the focus and this is my concern. But > if > there's a way for my app to capture the windows handle and "talk" directly > to > the app that may solve my problems. Any suggestions? Thanks again. > > Ben source for everything you need to communicate with, it may be pretty easy. No source? Not so easy. With or without source, there are many ways to "skin a cat". With source, you can communicate directly. Without, you're limited to the functionality provided by that other "window". If it accepts keystrokes, you can send them. If it accepts custom messages, you can send those too. Then, there's always DDE (that simply won't die <g>) -- Ken Halter - MS-MVP-VB - http://www.vbsight.com DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Please keep all discussions in the groups.. |
|||||||||||||||||||||||