|
-
May 13th, 2016, 11:26 AM
#1
Thread Starter
Fanatic Member
[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
-
May 13th, 2016, 11:49 AM
#2
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)
-
May 13th, 2016, 12:01 PM
#3
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.
-
May 13th, 2016, 12:06 PM
#4
Thread Starter
Fanatic Member
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.
-
May 13th, 2016, 12:07 PM
#5
Thread Starter
Fanatic Member
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
-
May 13th, 2016, 02:24 PM
#6
PowerPoster
Re: Show a progress form in front of app, but not all App
 Originally Posted by Bonnie West
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.
-
May 13th, 2016, 03:01 PM
#7
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|