Posted on 1998-10-19
Last Modified: 2012-05-04
I have opened up an application within an MDI Form.  That works fine.  However, I am attempting to place a MDI Child Form on top of that application.  It will act as a menu for that application.  Is it possible to have this "menu" stay on top of this application within the MDI Form?  Right now, my "menu" always remains in back of the application within the MDI Form.
Question by:NeedAnswer
  • 3
  • 2

Expert Comment

ID: 1440632
It is imposible, because MDI child will be always stay within MDI form border.
If you want this menu stay, you have one of the two option:
1. set the application menu the same as MDI child, and Show/Hide it while the MDI child is shown/hide
2. You can change the menu in runtime if you handle the menu items as an array at first place, which means you set a menu item's index to 0.

Good Luck

Author Comment

ID: 1440633
I understand that an MDI Child remains within the border of it's MDI Form.  But isn't it possible to force one MDI Child to remain on top of the other forms or applications that reside within the MDI parent Form.  I don't want it to remain on top of the MDI Form, just the other MDI Childs.

Expert Comment

ID: 1440634
yes it is:

Public Const SWP_SHOWWINDOW = &H40
Public Const HWND_TOPMOST = -1
Public Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
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

Usage is:

SetWindowPos(MdiChildForm1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW)

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!


Author Comment

ID: 1440635
This works for regular forms, but it does not seem to work for MDI Child forms.  I think that there is something small that I am missing.  I have done work like this for regular forms, but no MDI Child Forms.

Accepted Solution

timpeters earned 50 total points
ID: 1440636
It is possible that the reason it wont stay on top of your app isbecause it is an app and not a form.  Try using the API Function SetParent where you place another form to be the parent of your app.  Then add this form to the MDI form and place your menu on top of that.  That should solve your problem.


Author Comment

ID: 1440637
Thanks, that took care of it.

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question