Keeping a form on top of an MDI-parent 
Author Message
 Keeping a form on top of an MDI-parent

Here's a good one: I've got an MDI application that displays its children
forms fully maximized at all times. I do this because of the benefits of
MDI forms (I have a toolbar and status bar, etc.). What I want to do is
basically like Spell Check dialog in Word6: The Word6 document can be maximized
and the Spell Checker db stays on top. I can't make the form another child of
the MDI-parent because, if one MDI-child is maximized, they all must be. I
want the smaller form to 'float' on top of the maxed MDI-child.
I tried the SetWindowPos() API, but it causes problems because the form is on
top of everything! If you Alt+Tab to Progman, the form is still in front of
Progman (and even any system-modal dialogs that pop up).
This technique is seen in many apps, (Cue Cards in Access is a good one), so I
know it's possible; at least in C++. Does anyone know how to do this in VB???
I would be most appreciative.


Tue, 08 Jul 1997 12:19:42 GMT  
 Keeping a form on top of an MDI-parent

                                     I can't make the form another child of

Quote:
> the MDI-parent because, if one MDI-child is maximized, they all must be. I
> want the smaller form to 'float' on top of the maxed MDI-child.
> I tried the SetWindowPos() API, but it causes problems because the form is on
> top of everything! If you Alt+Tab to Progman, the form is still in front of
> Progman (and even any system-modal dialogs that pop up).

Though I'm not sure I follow all the minute details in your question, it
sounds like you might want to look into the windows function:  SetParent
which forces some object to be the parent of some other object.  You can
then use the zorder properties to decide which form is on the top.

Usual disclaimers apply.



Tue, 08 Jul 1997 23:24:37 GMT  
 Keeping a form on top of an MDI-parent

Quote:

>Here's a good one: I've got an MDI application that displays its children
>forms fully maximized at all times. I do this because of the benefits of
>MDI forms (I have a toolbar and status bar, etc.). What I want to do is
>basically like Spell Check dialog in Word6: The Word6 document can be maximized
>and the Spell Checker db stays on top. I can't make the form another child of
>the MDI-parent because, if one MDI-child is maximized, they all must be. I
>want the smaller form to 'float' on top of the maxed MDI-child.
>I tried the SetWindowPos() API, but it causes problems because the form is on
>top of everything! If you Alt+Tab to Progman, the form is still in front of
>Progman (and even any system-modal dialogs that pop up).
>This technique is seen in many apps, (Cue Cards in Access is a good one), so I
>know it's possible; at least in C++. Does anyone know how to do this in VB???
>I would be most appreciative.

If you were to use cresent's "CSFORM" you would have additional events of
application lost focus and application gotfocus, where you could then use some
comde to hide or unload your floating window.  You may even experiment with
the zorder property of your floating window, to make it the frontmost of only
your application.

Joe



Wed, 09 Jul 1997 00:44:12 GMT  
 Keeping a form on top of an MDI-parent

Quote:



>                                     I can't make the form another child of
>> the MDI-parent because, if one MDI-child is maximized, they all must be. I
>> want the smaller form to 'float' on top of the maxed MDI-child.
>> I tried the SetWindowPos() API, but it causes problems because the form is on
>> top of everything! If you Alt+Tab to Progman, the form is still in front of
>> Progman (and even any system-modal dialogs that pop up).

>Though I'm not sure I follow all the minute details in your question, it
>sounds like you might want to look into the windows function:  SetParent
>which forces some object to be the parent of some other object.  You can
>then use the zorder properties to decide which form is on the top.

>Usual disclaimers apply.

I replied to Andre to thank him for his input, but I guess I didn't do it right
because I don't see it here. Just wanted to let others know I found the andswer
on MSDN (PSS ID Number Q114775) "How to Create a Modeless Dialog Form In VB".
That term, "Modeless" was on the tip of my tongue! Any way this is great info
and I wanted to share it. The task is accomplished via the SetWindowWord API
call. It's really simple to use and works like this:

Declare Function SetWindowWord Lib "User" (ByVal hWnd As Integer, ByVal Index
As Integer, ByVal wNewWord As Integer) As Integer

Global Const GWW_HWNDPARENT = (-8)
Dim OriginalParenthWnd As Integer

Add the following code the Form_Load event of the form you want to "float":
OriginalParenthWnd = SetWindowWord(Me.hWnd, GWW_HWNDPARENT, Form1.hWnd)
(Replace Form1 above with the form you're 'floating' over)

Add the following code to the Form_Unload event of the same form:
Dim retVal As Integer
retVal = SetWindowWord(Me.hWnd, GWW_HWNDPARENT, OriginalParenthWnd)
(If you don't do the preceding, you will GPF...)



Wed, 09 Jul 1997 13:30:18 GMT  
 Keeping a form on top of an MDI-parent

Quote:

>Here's a good one: I've got an MDI application that displays its children
>forms fully maximized at all times. [snip]
>I want the smaller form to 'float' on top of the maxed MDI-child.
>I tried the SetWindowPos() API, but it causes problems because the
>form is on top of everything! .[snip]

Search for an example of 'SetWindowWord' in the VBTT94.
(How to keep a form on top of _a_ window, not _all_ windows).

*************************************************************************
Anshu Agarwal, Sunquest Information Systems.

*************************************************************************



Thu, 10 Jul 1997 21:44:00 GMT  
 Keeping a form on top of an MDI-parent
Terrell Cantrell said to ALL  about Keeping a form on top of an MDI-parent,
on 20 Jan 95  04:19:42:-

TC>Here's a good one: I've got an MDI application that displays its childr
TC>forms fully maximized at all times. I do this because of the benefits o
TC>MDI forms (I have a toolbar and status bar, etc.). What I want to do is
TC>basically like Spell Check dialog in Word6: The Word6 document can be m
TC>and the Spell Checker db stays on top.

Search for AlwaysOnTop in the KB.

Regards, Graham.
CIS# 100033,3647



 * Wave Rider 1.20 # 332 *
... SOTIDI SOFTWARE, PO Box 1747, NORTH SYDNEY NSW 2059, AUSTRALIA
~~~ Blue Wave/RA

-----------------------------------------------------------------------------

This message was processed by RAuucp from Merlin Systems Inc.
-----------------------------------------------------------------------------



Thu, 17 Jul 1997 02:56:06 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Keeping dialog box on top and accessing the parent form

2. Modifying object in MDI Parent form from MDI Child form

3. Accessing Objects on a Mdi Parent form from a Mdi Child form

4. MDI child forms on top of a picture on a MDI form

5. keeping child windows on top of a parent

6. Keeping controls in the backgroind on MDI Parent

7. Maximized MDI child form Covering Status bar on MDI parent

8. : How to keep a MDI-parent maximized?

9. set the MDI parent of MDI child forms that are in a DLL

10. Help: Change a MDI child's parent MDI form at run-time

11. Keeping an MDI-Window Always on Top

12. How to Keep an MDI Window Always on Top

 

 
Powered by phpBB® Forum Software