469,082 Members | 1,152 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,082 developers. It's quick & easy.

modeless dialog box

Hello,

Can somebody point me in the righ direction? I'm trying to keep a custom
dialog box 'on top' and visible above all other forms, even though it is
modeless. I'm trying to make it behave just like the 'Find' dialog works
within the VB 6 IDE. Even if your scrolling or typing on something else,
the 'Find' dialog remains on top and visible (although it has lost focus).
Using the 'Show' method for the form/dialog won't allow you to work on
another form.

Thanks,

Gord
Jul 17 '05 #1
3 7357
On Tue, 25 May 2004 05:51:56 GMT, "Gord" <x1******@telus.net> wrote:
Hello,

Can somebody point me in the righ direction? I'm trying to keep a custom
dialog box 'on top' and visible above all other forms, even though it is
modeless. I'm trying to make it behave just like the 'Find' dialog works
within the VB 6 IDE. Even if your scrolling or typing on something else,
the 'Find' dialog remains on top and visible (although it has lost focus).
Using the 'Show' method for the form/dialog won't allow you to work on
another form.


Option Explicit

Private Declare Function 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) As Long

Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2

Sub SetFloatWindow(FormName As Form)
Dim X%
X% = SWP_NOSIZE Or SWP_NOMOVE
Call SetWindowPos(Me.hwnd, _
True, 0, 0, 0, 0, X%)
End Sub

Private Sub Form_Load()
SetFloatWindow Me
End Sub

Jul 17 '05 #2
Only above the forms in your app, or above all application windows? Jerry's
SetWindowPos solution will do the latter ... if you only need it overtop
your app, use the owner parameter of the show method:

frmWhatever.Show vbModeless, frmMain

The frmWhatever will now "follow" frmMain if minimized or restored, yet
remain on-top but non-modal allowing interaction with the underlying forms.

--

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Gord" <x1******@telus.net> wrote in message
news:0aBsc.14950$g71.287@clgrps13...
: Hello,
:
: Can somebody point me in the righ direction? I'm trying to keep a custom
: dialog box 'on top' and visible above all other forms, even though it is
: modeless. I'm trying to make it behave just like the 'Find' dialog works
: within the VB 6 IDE. Even if your scrolling or typing on something else,
: the 'Find' dialog remains on top and visible (although it has lost focus).
: Using the 'Show' method for the form/dialog won't allow you to work on
: another form.
:
: Thanks,
:
: Gord
:
:

Jul 17 '05 #3
Much thanks J French and Randy,

I'm teaching myself VB 6 from Microsoft books for my own interest. For
practice, I'm doing a little program for my brother but ran into this
'dialog box' problem. Both solutions worked and were instructive, however,
I did need my dialog to be 'local' to my application.

Thanks again to you both. (I was running out of hair to pull out)

Gord
"Randy Birch" <rg************@mvps.org> wrote in message
news:qq*****************@news04.bloor.is.net.cable .rogers.com...
Only above the forms in your app, or above all application windows? Jerry's SetWindowPos solution will do the latter ... if you only need it overtop
your app, use the owner parameter of the show method:

frmWhatever.Show vbModeless, frmMain

The frmWhatever will now "follow" frmMain if minimized or restored, yet
remain on-top but non-modal allowing interaction with the underlying forms.
--

Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Gord" <x1******@telus.net> wrote in message
news:0aBsc.14950$g71.287@clgrps13...
: Hello,
:
: Can somebody point me in the righ direction? I'm trying to keep a custom : dialog box 'on top' and visible above all other forms, even though it is
: modeless. I'm trying to make it behave just like the 'Find' dialog works : within the VB 6 IDE. Even if your scrolling or typing on something else, : the 'Find' dialog remains on top and visible (although it has lost focus). : Using the 'Show' method for the form/dialog won't allow you to work on
: another form.
:
: Thanks,
:
: Gord
:
:

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Rikkert | last post: by
1 post views Thread by Carmine | last post: by
reply views Thread by Andrew | last post: by
1 post views Thread by andrew | last post: by
2 posts views Thread by proit_123 | last post: by
8 posts views Thread by proit_123 | last post: by
reply views Thread by Sin Jeong-hun | last post: by
3 posts views Thread by DoB | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.