|
-
Sep 5th, 2005, 12:18 PM
#1
Thread Starter
Admodistrator
Topmost problem?
I dont understand this one at all. No matter what, i have a form thats being rude and wont stay topmost whatever i do. If i use setwindowpos or load it so its vbmodal it always goes to the back, any other ideas here? Ive never had such a troublesome form
-
Sep 5th, 2005, 12:56 PM
#2
Re: Topmost problem?
Have you seen this thread from the VB FAQ?
-
Sep 5th, 2005, 01:56 PM
#3
Fanatic Member
Re: Topmost problem?
Are you having this trouble with a compiled program? VB doesn't let the form be topmost unless you compile it.
Hope this helps,
Sir Loin
-
Sep 5th, 2005, 04:44 PM
#4
Thread Starter
Admodistrator
Re: Topmost problem?
martin, i dont need that as ive already used all the thoughts mentioned in it. Im positive im setting it right, so my question was more towards why isnt it working then how to do so. Sir loin, i thought you might be right, but it doesnt work out of IDE too.
Code:
LoadFrm.Show
LoadFrm.Visible = True
Call SetWindowPos(LoadFrm.hwnd, -1, 0, 0, 0, 0, 3)
should at least make it visible..but it flashes and dissapears..
-
Sep 5th, 2005, 04:58 PM
#5
Thread Starter
Admodistrator
Re: Topmost problem?
And i just found out..if i walk thru the code it makes it topmost..i dont get it
-
Sep 5th, 2005, 08:25 PM
#6
Thread Starter
Admodistrator
Re: Topmost problem?
so can i get some help here?
-
Sep 5th, 2005, 08:27 PM
#7
Re: Topmost problem?
Are you doing this in form_load? If so, put this before the SetWindowPos call:
EDIT: Its one of those days for me . I see you've done that. It helps to use the constants instead of numbers:
VB Code:
Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const HWND_TOPMOST = -1
Dim ret As Long
ret = SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_SHOWWINDOW)
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Sep 5th, 2005, 08:28 PM
#8
Re: Topmost problem?
Are you using a timer in your app?
-
Sep 5th, 2005, 08:31 PM
#9
Thread Starter
Admodistrator
-
Sep 5th, 2005, 08:49 PM
#10
-
Sep 5th, 2005, 10:57 PM
#11
^:^...ANGEL...^:^
Re: Topmost problem?
Start a new exe project and it should have a Form in it.
Go to the code section of the form and paste the following and run the project.
VB Code:
Option Explicit
Private Declare Sub SetWindowPos Lib "user32" _
(ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long)
Private Const HWND_TOPMOST = -1
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOACTIVATE = &H10
Private Declare Function ShowWindow Lib "user32" _
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_SHOWNOACTIVATE = 4
Private Sub Form_Load()
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_NOMOVE Or SWP_NOSIZE
ShowWindow Me.hwnd, SW_SHOWNOACTIVATE
End Sub
-
Sep 6th, 2005, 01:03 AM
#12
Re: Topmost problem?
This works for me...
VB Code:
Load frmSplash
DoEvents
Success = SetWindowPos(frmSplash.hWnd, HWND_TOPMOST, 0, 0, 0, 0, flags)
DoEvents
Unload Me
frmItineraryEntry.Show
-
Sep 6th, 2005, 06:18 PM
#13
Thread Starter
Admodistrator
Re: Topmost problem?
okay. i already said i know it works in other projects. I just want to know how to fix it/any debugging i should do.
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
|