CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 45
  1. #16
    Join Date
    Jan 2009
    Posts
    399

    Re: Activate MDI window

    Quote Originally Posted by Arjay View Post
    So what started out as a post wondering why focus can't be set on an MDI application has now turned into a single instance tray notify application?
    .
    I'll try to make a test project. The same result I got if I notify the user with a random system tray balloon and user click to that balloon, the behavior is the same. So, the issue is the same as I posted first time. I give you this extra details in order to have a clear image about this issue, that is all.

  2. #17
    Join Date
    Jan 2009
    Posts
    399

    Re: Activate MDI window

    I have built a test program that illustrate the issue. Just start it and wait 5 seconds. Should see a system tray icon balloon. Click on that balloon, and you'll see that the main frame is shown, but doesn't get the focus.
    Attached Files Attached Files
    Last edited by mesajflaviu; August 6th, 2020 at 07:17 AM.

  3. #18
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Activate MDI window

    Look at the messages you're handling in CSystemTray::OnTrayNotification(UINT wParam, LONG lParam)

    I suspect you probably want to handle some left button messages
    Last edited by GCDEF; August 5th, 2020 at 12:53 PM.

  4. #19
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Activate MDI window

    Quote Originally Posted by mesajflaviu View Post
    I have built a test program that illustrate the issue. Just start it and wait 5 seconds. Should see a system tray icon balloon. Click on that balloon, and you'll see that the main frame is shown, but doesn't get the focus.
    OK, I have tested your sample.
    If I changed the CMainFrame::On0Restore() to
    Code:
    void CMainFrame::On0Restore()
    {
    	ShowWindow(SW_RESTORE);
    	SetForegroundWindow();
    }
    then I could very easy get a keyboard input of CMainFrame. I just typed Alt+F and what I see is
    Name:  Activate MDI from tray.png
Views: 997
Size:  14.5 KB

    I tried is with double click, with right mouth button click and with a left click on the popup menu.
    Last edited by VictorN; August 5th, 2020 at 02:33 PM.
    Victor Nijegorodov

  5. #20
    Join Date
    Jan 2009
    Posts
    399

    Re: Activate MDI window

    Yes, you are right, but please do this trial from Windows Explorer. I mean: go in Debug folder, and start the app from there, and wait 5 seconds, and then click on that balloon. This is the real situation.
    Attached Images Attached Images  

  6. #21
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Activate MDI window

    Quote Originally Posted by mesajflaviu View Post
    Yes, you are right, but please do this trial from Windows Explorer. I mean: go in Debug folder, and start the app from there, and wait 5 seconds, and then click on that balloon. This is the real situation.
    Hmm, in that case it doesn't get (or, maybe just loose) the focus.
    Victor Nijegorodov

  7. #22
    Join Date
    Jan 2009
    Posts
    399

    Re: Activate MDI window

    I updated the sample project because a class inside the project has errors in x64 configuration. Thank you for your time.

  8. #23
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Activate MDI window

    Quote Originally Posted by mesajflaviu View Post
    Yes, you are right, but please do this trial from Windows Explorer. I mean: go in Debug folder, and start the app from there, and wait 5 seconds, and then click on that balloon. This is the real situation.
    It's really frustrating when you tell somebody what the problem is and they ignore your post.

    I told you where to look

  9. #24
    Join Date
    Jan 2009
    Posts
    399

    Re: Activate MDI window

    @GCDEF, thank you for your time and sorry if I cause you any issue. I did checked what you said, but in that location, CSystemTray::OnTrayNotification, I don't saw any problem. In that handler, is managed the tray notification, and that notification work fine. Please tell me if I miss understood something.
    Last edited by mesajflaviu; August 6th, 2020 at 02:04 PM.

  10. #25
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Activate MDI window

    Quote Originally Posted by mesajflaviu View Post
    @GCDEF, thank you for your time and sorry if I cause you any issue. I did checked what you said, but in that location, CSystemTray::OnTrayNotification, I don't saw any problem. In that handler, is managed the tray notification, and that notification work fine. Please tell me if I miss understood something.
    Look at the messages you're processing.

    WM_RBUTTONUP
    WM_LBUTTONDBLCLK
    NIN_BALLOONUSERCLICK

    I don't see anything that would handle a single left button click on the try icon.

    You should get all that CE stuff out of there too. It's just cluttering stuff up.

  11. #26
    Join Date
    Jan 2009
    Posts
    399

    Re: Activate MDI window

    No, on icon single left button event is happen nothing. On icon double click the app is shown, on icon right click the context menu is shown and on click on tray balloon is calling CMainFrame::On0Restore method (which is not work well).

    I used this code from another programming site, I used as I found it. I can clean up CE things, of course.
    Last edited by mesajflaviu; August 7th, 2020 at 05:16 AM.

  12. #27
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Activate MDI window

    Quote Originally Posted by mesajflaviu View Post
    No, on icon single left button event is happen nothing. On icon double click the app is shown, on icon right click the context menu is shown and on click on tray balloon is calling CMainFrame::On0Restore method (which is not work well).

    I used this code from another programming site, I used as I found it. I can clean up CE things, of course.
    Which is exactly what I said. I showed you the messages you're processing, and they're all working. Add code to make the left button work.

  13. #28
    Join Date
    Jan 2009
    Posts
    399

    Re: Activate MDI window

    Well, I would that, but it would help me ? Because the issue here is that CMainFrame is not activate it. Is shown at user click on tray balloon, but is not active . .. see my image and my sample project. Of course, I can try to call CMainFrame::On0Restore on icon left click, but right now this method is called from tray balloon, and is not working. Sorry if I miss understood what you are tried to say.

  14. #29
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Activate MDI window

    Quote Originally Posted by mesajflaviu View Post
    Well, I would that, but it would help me ? Because the issue here is that CMainFrame is not activate it. Is shown at user click on tray balloon, but is not active . .. see my image and my sample project. Of course, I can try to call CMainFrame::On0Restore on icon left click, but right now this method is called from tray balloon, and is not working. Sorry if I miss understood what you are tried to say.
    I guess implementing and testing what GCDEF suggested would be much faster than posting this message and waiting for the replies.
    Victor Nijegorodov

  15. #30
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Activate MDI window

    Quote Originally Posted by mesajflaviu View Post
    Well, I would that, but it would help me ? Because the issue here is that CMainFrame is not activate it. Is shown at user click on tray balloon, but is not active . .. see my image and my sample project. Of course, I can try to call CMainFrame::On0Restore on icon left click, but right now this method is called from tray balloon, and is not working. Sorry if I miss understood what you are tried to say.
    I wouldn't post it if I didn't think it would help. You have a function that handles tray notifications. CSystemTray::OnTrayNotification(UINT wParam, LONG lParam). Step through it and see how it works.

    It handles some messages, all of which work. It doesn't handle a left button message so nothing is happening.

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

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

Featured