Solved

Display Non-Modal form over Modal form

Posted on 2002-05-30
8
537 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
  • 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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 100 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

840 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