|
-
Jun 6th, 2001, 02:48 PM
#1
Thread Starter
Junior Member
setting top window current
Seriously, I have spent over 12 hours on this one problem. I'm begging you to help me.
What is the code required to utilize API functions to set the top window current?
I use the AppActivate function to set another application current. The application that is being sent current is an application that I did NOT develop. When the focus is switched to this application, the parent window is active. I want to set current whatever child window is the topmost window.
I am using VB5 and this must work on both NT4 and 2000.
Thanks very much to anyone that can help me.
Ryan
-
Jun 6th, 2001, 03:52 PM
#2
Junior Member
I think this is what you are looking for.
Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, Y, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Const TOPMOST_FLAGS = SWP_NOMOVE Or SWP_NOSIZE
'// Resets the windows position in the ZOrder
Public Sub MakeNormal(lngHwnd As Long)
SetWindowPos lngHwnd, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
End Sub
'// Places the window at the top of the ZOrder
'// and keeps it there
Public Sub MakeTopMost(lngHwnd As Long)
SetWindowPos lngHwnd, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
End Sub
-
Jun 7th, 2001, 02:25 AM
#3
Registered User
Caution: I personally wouldn't use:
SetWindowPos lngHwnd, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
As your app's will dominate over all others unless it is minimised, which will really annoy users
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
|
Click Here to Expand Forum to Full Width
|