-
Keep window on top (of all forms)
My VB6 program needs to keep a window activated by another program on top
of all currently visible windows. For background, my operating system is
WinNT Workstation 4.0 (Service Pack 6) and all programs are 32-bit implementations.
The problem arises when the user selects print-to-file. The program external
to my own activates a function in an always- running auxilliary .EXE that
accepts the user's inputted directory location. This text input box often
pops up behind both my main form and the calling program's main form.
I know the name and location of the input box executable, but that's about
all. What's the best way to keep its window on top (and in focus)?
Thanks in advance.
-
Re: Keep window on top (of all forms)
Get the window handle of the window that pops up, and give it OnTop status.
--
Eric D. Burdo, Red-Leif International
VB Programmer and Consultant
<http://www.redleif.com/vb>
*** Please reply to the newsgroup so all can benefit. ***
"kanders" <kanders@pacbell.net> wrote in message news:3a01fd78$1@news.devx.com...
>
> My VB6 program needs to keep a window activated by another program on top
> of all currently visible windows. For background, my operating system is
> WinNT Workstation 4.0 (Service Pack 6) and all programs are 32-bit implementations.
>
> The problem arises when the user selects print-to-file. The program external
> to my own activates a function in an always- running auxilliary .EXE that
> accepts the user's inputted directory location. This text input box often
> pops up behind both my main form and the calling program's main form.
>
> I know the name and location of the input box executable, but that's about
> all. What's the best way to keep its window on top (and in focus)?
>
> Thanks in advance.
-
Re: Keep window on top (of all forms)
Get the window handle of the window that pops up, and give it OnTop status.
--
Eric D. Burdo, Red-Leif International
VB Programmer and Consultant
<http://www.redleif.com/vb>
*** Please reply to the newsgroup so all can benefit. ***
"kanders" <kanders@pacbell.net> wrote in message news:3a01fd78$1@news.devx.com...
>
> My VB6 program needs to keep a window activated by another program on top
> of all currently visible windows. For background, my operating system is
> WinNT Workstation 4.0 (Service Pack 6) and all programs are 32-bit implementations.
>
> The problem arises when the user selects print-to-file. The program external
> to my own activates a function in an always- running auxilliary .EXE that
> accepts the user's inputted directory location. This text input box often
> pops up behind both my main form and the calling program's main form.
>
> I know the name and location of the input box executable, but that's about
> all. What's the best way to keep its window on top (and in focus)?
>
> Thanks in advance.
-
Re: Keep window on top (of all forms)
"Eric D. Burdo" <vbtips@redleif.com> wrote:
>Get the window handle of the window that pops up, and give it OnTop status.
While Eric's answer is entirely accurate, it probably doesn't give enough
information to actually implement a solution. Use FindWindow to retrieve
the handle to the appropriate window (remembering to check that you don't
get back a null handle, which indicates that the window sought wasn't found).
Then, use SetWindowPos to put the window on top, specifying HWND_TOPMOST
if you want to make sure this window is always on top of all other normal
windows or just HWND_TOP to put it on top initially if you want to let the
user switch to a different window after this one is displayed.
The relevant functions have declarations listed in the API Viewer.
Travis Hall
-
Re: Keep window on top (of all forms)
"Eric D. Burdo" <vbtips@redleif.com> wrote:
>Get the window handle of the window that pops up, and give it OnTop status.
While Eric's answer is entirely accurate, it probably doesn't give enough
information to actually implement a solution. Use FindWindow to retrieve
the handle to the appropriate window (remembering to check that you don't
get back a null handle, which indicates that the window sought wasn't found).
Then, use SetWindowPos to put the window on top, specifying HWND_TOPMOST
if you want to make sure this window is always on top of all other normal
windows or just HWND_TOP to put it on top initially if you want to let the
user switch to a different window after this one is displayed.
The relevant functions have declarations listed in the API Viewer.
Travis Hall
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks