|
-
Aug 21st, 2002, 02:09 PM
#1
Thread Starter
Member
Keeping a Window on top (not a form)
Hello,
I'm trying to keep the 'open with' dialog on top until you select a program or cancel. Or bring it back to the top if you right click on the listbox. I've posted my code, could somebody tell me what I'm doing wrong. The only examples i've seen for BringWindowToTop API are 'BringWindowToTop form2.hwnd'. How can I apply that to the 'open with' dialog box??
'=========================
Private Sub lstLoad_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
'Bring up the 'open with' dialog and open selected file
'=========================
Dim WinWnd As Long
Dim zhWnd as Long
If lstLoad.ListIndex <> -1 Then
WinWnd = FindWindow(vbNullString, "Open With") 'if the openwith dialog is already open
If WinWnd = 0 Then
Call GetListItemInfo(lstLoad)
If Button = vbRightButton Then
Shell ("rundll32.exe shell32.dll,OpenAs_RunDLL " & strFullName)
zhWnd = GetActiveWindow
End If
Else
BringWindowToTop(zHwnd)
End If
End If
End Sub
Thank you,
Rick
-
Aug 21st, 2002, 05:35 PM
#2
Frenzied Member
VB Code:
Private Sub lstLoad_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
'Bring up the 'open with' dialog and open selected file
'=========================
Dim WinWnd As Long
Dim zhWnd As Long
If lstLoad.ListIndex <> -1 Then
zhWnd = FindWindow(vbNullString, "Open With") 'if the openwith dialog is already open
If zhWnd = 0 Then
Call GetListItemInfo(lstLoad)
If Button = vbRightButton Then
Shell ("rundll32.exe shell32.dll,OpenAs_RunDLL " & strFullName)
zhWnd = GetActiveWindow
End If
Else
SetWindowPos zhWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
End If
End If
End Sub
Tell me if it did!!!
-
Aug 21st, 2002, 08:45 PM
#3
Thread Starter
Member
moinkhan,
Beautiful!, Thanks a bunch!
-
Aug 21st, 2002, 10:54 PM
#4
Software Eng.
I thought GetActiveWindow only worked for windows that you owned? If this doesn't work, then just change it to "GetForegroundWindow"
-
Aug 22nd, 2002, 10:32 AM
#5
Thread Starter
Member
Hi Megatron,
I tried your suggestion with the GetForegroundWindow, the result from that and GetActiveWindow is the same. Would there be any reason to use one over the other?
Thanks for the reply,
Rick
-
Aug 22nd, 2002, 01:36 PM
#6
Frenzied Member
GetActiveWindow returns the Active window of the Calling thread..
While GetForeGroundWindow returns the Foreground window which currently is on top of all the windows.. of all the applicaitons..
-
Aug 27th, 2002, 10:51 AM
#7
Software Eng.
Originally posted by rruble88
Hi Megatron,
I tried your suggestion with the GetForegroundWindow, the result from that and GetActiveWindow is the same.
Rick
What is the the result? Flashing of the titlebar?
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
|