Results 1 to 7 of 7

Thread: [RESOLVED] Show a progress form in front of app, but not all App

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2015
    Posts
    643

    Resolved [RESOLVED] Show a progress form in front of app, but not all App

    I have a small problem, I think it is stupid, but I don't find a way to fix it.

    In my applications (MDI applications), I display a progress bar for long running reports and process.

    So, I have a form (non MDI) that I show with a progress bar.
    The problem is that, if I use another application (like a browser, or any other app), the progress bar is recurrently showed in top of all applications.

    Due to all routines, the progress form, is sometime hidden, sometime shown (several call to routines that shows the form, then once the work is done, it hides it).

    This is annoying, as I get back in front the progress bar over other applications.

    So, is there a way to have only the form in top, only on his own application?

    I tried all solutions, with SetWindowPos, Topmost, non top most, having the progress form as a child form and so, not outside, etc...
    But no success till now.

    If someone has an idea, I can take it, to make some tests.

    I think that I forget something stupid somewhere, but I can't figure what.

    Thanks in advance

  2. #2
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Show a progress form in front of app, but not all App

    Show your non-MDIChild Form like this:

    Code:
    nonMDIChildForm.Show vbModeless, MDIForm
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  3. #3
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Show a progress form in front of app, but not all App

    Maybe I'm not reading your post correctly but the following allows Form2 to stay on top of Form1 but other apps can be on top for Form2

    Code:
    Private Sub Command1_Click()
    Form2.Show , Me
    For n = 1 To 1000000
      Form2.Text1.Text = n
      DoEvents
    Next n
    End Sub


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2015
    Posts
    643

    Re: Show a progress form in front of app, but not all App

    Bonnie, I knew, it was a stupidity (that hurted me for years).
    I am so stupid....
    My first test, replying now, while doing calculations, is giving you the "Saint Graal"

    I missed something so stupid.
    I was not so important, for many years, so I haven't look too much.

    I will do some more deep tests

    Thanks again.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2015
    Posts
    643

    Re: Show a progress form in front of app, but not all App

    NB : just added
    frmProgress.Show vbModeless, frmMain

    in the frmprogress load and all seems good

  6. #6
    PowerPoster
    Join Date
    Mar 2005
    Posts
    2,943

    Re: Show a progress form in front of app, but not all App

    Quote Originally Posted by Bonnie West View Post
    Show your non-MDIChild Form like this:

    Code:
    nonMDIChildForm.Show vbModeless, MDIForm
    hi Bonnie...
    i canot understand you suggestion, can you post a simple project?
    I'm very interesting on it!
    Tks.

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Show a progress form in front of app, but not all App

    Don't need a project, just a quick break down:
    nonMDIChildForm.Show vbModeless, MDIForm


    nonMDIChildForm -- the name of the form (or instance) that you want to show - Form1, MyForm, YourForm, MainForm, PRgoForm... what ever....

    .Show -- calls the show method. The .Show method is what actually displays the form, and has two optional parameters - Display style and Owner

    vbModeless, -- one of two display modes. the other is vbModal - vbModaless means it will show the form and keep on going. vbModal will show the form, then pause until the user dismisses the form, and then it continues. Think of a MsgBox ... or somekind of dialog form - options maybe ... those are types of Modal forms.

    MDIForm -- the name of the owning form. Form1, MyForm, YourForm, MainForm, PRgoForm... what ever.... MDIForm and nonMDIChildForm shouldn't be the same....



    Let's say I have a form that shows the progress of a navigation, but I still want things to keep running the background.
    The main form the user interacts with is MainGPSForm and the navigation form is MapNaviForm .... so the same call above would look like this:

    Dim myNaviForm as MapNaviForm
    Set myNaviForm = new MapNaviForm
    myNaviForm.Show vbModaless, MainGPSForm


    that creates a new instance of the form, then shows it using modaless style, and making the MainGPSForm the owner.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width