[RESOLVED] VB6 user control and Win7 task bar focus problem
Hi I have noticed something wierd.
If I have VB app which has VB user control (VB ocx control or user control directly in project) on it.
When I minimize that apps main window from taskbar icon or system menu then previous app does not get focus.
If I remove user control then everything works as planned.
I checked with Spy++ and it seems that VB user control creates some kind of proxy window (class name = "Static") for user control. If I kill this window explicitly then focus works again (this ofcourse is not the solution).
Is there any solution for this problem?
Or is this just known feature of VB6 with which we have to live?
I attached two very simple examples for reference, one with user control and other without it.
System Info
Windows7 enterprise, 64 bit, Service pack1.
VisualStudio 6 SP6
any information is appreciated.
PS: This does not happen with controls done with VC6, but porting from VB6 to VC6 is not an option at the moment.
Re: VB6 user control and Win7 task bar focus problem
Hi,
Sorry that i can give no solution - just wanted to confirm that i know this (miss)behaviour since a long time.
iirc that happend even back in NT4 / w2000.
i tried to get around this, but all experiments messed up the Alt-Tab order even more...
But i still would be happy to find a solution (if there is).
Re: VB6 user control and Win7 task bar focus problem
What do you mean by "When I minimize that apps main window from taskbar icon or system menu then previous app does not get focus."? I compiled both projects, open both, the minimized that one with a usercontrol (mdi) and the other project gets focused as I am able to type in its textbox without clicking or focusing on it.
Regards,
™
As a gesture of gratitude please consider rating helpful posts. c",)
Re: VB6 user control and Win7 task bar focus problem
The reason other windows don't get the focus when your main window minimizes is because the unseen Static window (whose size is 0x0 pixels) is actually visible to the OS and has a normal window state (i.e. it's neither minimized nor maximized). It is therefore actually the one that receives the focus when you minimize your main window.
There are at least 2 possible solutions to this issue: either hide that window or minimize it. I'd go for making it truly invisible.
Last edited by Bonnie West; Aug 22nd, 2014 at 07:34 AM.
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
Re: VB6 user control and Win7 task bar focus problem
Originally Posted by dee-u
What do you mean by "When I minimize that apps main window from taskbar icon or system menu then previous app does not get focus."? I compiled both projects, open both, the minimized that one with a usercontrol (mdi) and the other project gets focused as I am able to type in its textbox without clicking or focusing on it.
You have to open mdichild form first which contains the user control. After that other applications dont get focus when MDIApp is mimimized.
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