Results 1 to 8 of 8

Thread: [RESOLVED] VB6 user control and Win7 task bar focus problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2014
    Posts
    4

    Resolved [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.
    Attached Files Attached Files

  2. #2
    New Member
    Join Date
    Jun 2009
    Posts
    10

    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).

  3. #3
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    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",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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

    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
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2014
    Posts
    4

    Re: VB6 user control and Win7 task bar focus problem

    Quote Originally Posted by dee-u View Post
    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.

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2014
    Posts
    4

    Re: VB6 user control and Win7 task bar focus problem

    Thanks for an answer Bonnie.
    What do you mean by making it truly invisible, is there some API call or some stule attrribute which has to bet set?

  7. #7

    Thread Starter
    New Member
    Join Date
    Aug 2014
    Posts
    4

    Re: VB6 user control and Win7 task bar focus problem

    Quote Originally Posted by Vaakneri View Post
    Thanks for an answer Bonnie.
    What do you mean by making it truly invisible, is there some API call or some stule attrribute which has to bet set?
    Figured it out, removing WS_VISIBLE does the trick.

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

    Re: VB6 user control and Win7 task bar focus problem

    Glad you figured it out.


    Don't forget to mark this thread Resolved!

    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)

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