|
-
Jun 13th, 2005, 12:41 PM
#1
Activate Window
I have a form that isn't sizeable, as a background to my app. If the user alt-tabs to a different app, my program is no longer shown in the taskbar, and can only be continued by using the task manager to Switch To.
I am thinking that I should be able to have the user restart the app to continue, but am having trouble making it so. Right now, if the previous instance of the app is true, I end starting it up again.
What do I have to do to "switch to" the previous instance? I know it can't be too difficult, but have tried a few different ways, including my find window app to send the wm_activate message to it. That seems kind of overkill.
Can't I use ME when I restart it to start a previous instance?
Thanks.
Last edited by dglienna; Jun 13th, 2005 at 01:32 PM.
-
Jun 13th, 2005, 12:59 PM
#2
Re: Activate Window
 Originally Posted by dglienna
I have a form that isn't sizeable, as a background to my app. If the user alt-tabs to a different app, my program is no longer shown in the taskbar, and can only be continued by using the task manager to Switch To.
I am thinking that I should be able to have the user restart the app to continue, but am having trouble making it so. Right now, if the previous instance of the app is true, I end starting it up again.
What do I have to do to "switch to" the previous instance? I know it can't be too difficult, but have tried a few different ways, including my find window app to send the wm_activate message to it. That seems kind of overkill.
Can't I use ME when I restart it to start a previous instance?
Thanks.
Whay about using FindWindow to get its handel and then using that as the parameter for the SetForegroundWindow to set focus to it?
Cheers,
RyanJ
-
Jun 13th, 2005, 01:00 PM
#3
Re: Activate Window
Is this Form set as the StartUp object? Is it only used as a background, so you always have other forms loaded?
-
Jun 13th, 2005, 01:15 PM
#4
Re: Activate Window
When I call frmBackgroun as the startup object from Sub Main, it will automatically show frmMain to start the app, so I want to get the previous instance of the program.
Right now, if i use frmBackground.show, by calling the app again, everything works, except that a new instance of the app starts and the form is shown.
There are many forms that could be activated when the app is hidden, and I want to always go back to frmBackground.
SetForeground Window might work, but I'm not sure
-
Jun 13th, 2005, 01:18 PM
#5
Re: Activate Window
I might have misunderstood your question but I just don't understand why your Main form isn't available from the taskbar. Maybe you don't want it to be but if you from the background form would call it up like this it would.
VB Code:
Private Sub Form_Load()
'frmBackground
frmMain.Show vbModeless, Me
End Sub
-
Jun 13th, 2005, 01:18 PM
#6
Re: Activate Window
 Originally Posted by dglienna
When I call frmBackgroun as the startup object from Sub Main, it will automatically show frmMain to start the app, so I want to get the previous instance of the program.
Right now, if i use frmBackground.show, by calling the app again, everything works, except that a new instance of the app starts and the form is shown.
There are many forms that could be activated when the app is hidden, and I want to always go back to frmBackground.
SetForeground Window might work, but I'm not sure
But by using FindWindow you could use the unique title of that form and set focus to it that way it should always set focus on the one you need 
Cheers,
RyanJ
-
Jun 13th, 2005, 01:30 PM
#7
Re: Activate Window
Thanks Joacim. I looked at it again, and I had ShowinTaskbar set to False
I thought that I had checked that. I think this is resolved.
-
Jun 13th, 2005, 01:35 PM
#8
Re: Activate Window
It almost sounds like your trying to create your own MDI type app. Maybe, depending on what your actually doing,
you would be better off using an MDI form.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 13th, 2005, 01:42 PM
#9
Re: Activate Window
 Originally Posted by RobDog888
It almost sounds like your trying to create your own MDI type app. Maybe, depending on what your actually doing,
you would be better off using an MDI form. 
I was thinking that it might be more like the old style installers that often had a gradient background. Anyway, thanks for the unexpected reps dg
-
Jun 13th, 2005, 02:11 PM
#10
Re: Activate Window
Just a full screen app to mimick the old DOS program. Now, they can do other things without losing their work, and I don't have to worry about multiple instances running. This is a point of sale app with 23 forms, and wouldn't work as an MDI app. I thought of it, though. It's menu driven.
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
|