?
Solved

Display Non-Modal form over Modal form

Posted on 2002-05-30
8
Medium Priority
?
543 Views
Last Modified: 2008-03-17
My MDI application has a 'pop-up' form that displays status - like "Loading..." or "Please Wait...".  This form is set to be 'top-most' by standard API calls, and then hidden when the calling form is done, using unload.  It works great with non-modal forms.

Some, but not all forms that need to call this 'pop-up' form are modal.  I've been having a bear of a time trying to figure out how to best pop-up of modal and non-modal forms.

I'm not stuck with any particular method (I'm flexible), but I'm sure there's GOT to be an API call or something that will get around this (VB ?) limitation.

HELP, please!
0
Comment
Question by:dslocum
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 7044442
Not within an application you cannot. The fact that a form is application modal which is the way that VB sets it means that you cannot popup anything over the top of this except for other modal forms such as a message box.
0
 
LVL 4

Expert Comment

by:RichW
ID: 7044456
Tim, can he create an ActiveX EXE file and use that as the pop-up form and, launch it from either modal or non-modal forms?

I've never had to do that in this situation, but since it's an asynchronous process, maybe that would work???

RichW
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 7044473
That should work, anything which is not in the same process as the original application doesn't have to follow the same rules as ApplicationModal cannot apply to it. Only a SystemModal dialog would cause a problem in this case.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:trkcorp
ID: 7044519
Just a thought, couldn't you create a duplicate MODAL form and use it where MODAL forms are used and use the original where MODELESS forms are used, keep hiding the MODELESS and unload the MODAL?  There is no problem displaying a new MODAL form on top of a MODAL form...  The only thing is the new duplicate MODAL version will have to drive whatever action is supposed to be taking place because it will have focus, or control, and then manage its own unload.  This should work IF it isn't too much trouble to allow the new MODAL version to drive. If it is then Brother Slocum is just between a rock and a hard place.
0
 
LVL 15

Accepted Solution

by:
ameba earned 400 total points
ID: 7044686
To show a form from modal or non-modal form, instead of "Show" use:
     frmPop.ShowStatus "Hello from Modal form"

' frmPop form --------------------------------------------
Option Explicit
'APIs for showing the window without activating it:
Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal _
    nCmdShow As Long) As Long
Private Const SW_SHOWNOACTIVATE = 4

'APIs for making the window a top-most window:
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
Private Const HWND_TOPMOST = -1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOACTIVATE = &H10

Public Sub ShowStatus(someinfo As String)
    Load Me
    Caption = someinfo
   
    ShowWindow hWnd, SW_SHOWNOACTIVATE 'Show the form, but don't activate it.
End Sub

Public Sub HideStatus()
    Unload Me
End Sub

Private Sub Form_Load()
    'Make this a topmost window, as is appropriate for a tooltip
    SetWindowPos hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE _
        Or SWP_NOSIZE Or SWP_NOACTIVATE
End Sub


Ref.: HotTrack sample
http://msdn.microsoft.com/code/default.asp?url=/msdn-files/026/000/115/readme_txt.asp
check frmToolTip.ShowToolTip / frmToolTip.HideToolTip
0
 
LVL 4

Expert Comment

by:trkcorp
ID: 7045140
ameba, I like that!
0
 
LVL 1

Author Comment

by:dslocum
ID: 7045597
Thank you all for your helpful input.

ameba:  In the words of the late game show "Hollywood Squares".... "Circle Gets the Square" !!!

 ameba --- some of the best points I've ever spent!

Thanks
0
 
LVL 15

Expert Comment

by:ameba
ID: 7045644
Thanks, all  :-)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

777 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