[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 547
  • Last Modified:

Display Non-Modal form over Modal form

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
dslocum
Asked:
dslocum
  • 2
  • 2
  • 2
  • +2
1 Solution
 
TimCotteeCommented:
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
 
RichWCommented:
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
 
TimCotteeCommented:
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!

 
trkcorpCommented:
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
 
amebaCommented:
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
 
trkcorpCommented:
ameba, I like that!
0
 
dslocumAuthor Commented:
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
 
amebaCommented:
Thanks, all  :-)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now