I uploaded new version of project, I clean up CSystemTray class from CE stuff, but only from CSystemTray::OnTrayNotification method. I added the case for WM_LBUTTONDOWN, where I put a TRACE macro.
Good grief dude. All you need to do is copy some code from one of the messages that does work into your left button code. I don't know how much simpler to make it. Of course it didn't work, there's no code hooked up to it. The OnRestore code was working.
Once you get it working by following GCDEFs advice and copy the working code to where you need it, do yourself a favor and take your code to the next level.
Do this by refactoring and remove all the duplicate code. In other words put one copy of the copied code into a method, and call that method on other places in the code. You end up with fewer lines of code and only need to debug one method.
For those folks that like to have labels for things, this is called the DRY principle; meaning, "Don't Repeat Yourself".
I have made those CSystemTray changes only because GCDEF told me that. But I don't know what is the purpose of this change. Sorry. The reported issue is on activating CMainFrame (MDI) window. And this MDI window activation could be done from anywhere, not from CSystemTray::whatever-method only.
Good grief dude. All you need to do is copy some code from one of the messages that does work into your left button code. I don't know how much simpler to make it. Of course it didn't work, there's no code hooked up to it. The OnRestore code was working.
Sorry, I saw your message just now. Can you explain what you said with: "The OnRestore code was working" ? I have tried again, but I saw no change (meant is not working correctly).
Thank you.
Last edited by mesajflaviu; August 10th, 2020 at 07:14 AM.
Sorry, I saw your message just now. Can you explain what you said with: "The OnRestore code was working" ? I have tried again, but I saw no change (meant is not working correctly).
Thank you.
Did you write any code to go with your left button down message yet?
When I moved the click on balloon code to icon left click the MDI app activation has been made, indeed. But I need this behavior on balloon click, not on icon left click. So, I am thinking how to simulate icon left click when user made click on balloon. However, CMainFrame::On0Restore code is not ok. I guess that code should work as expected. And is not happen.
When I moved the click on balloon code to icon left click the MDI app activation has been made, indeed. But I need this behavior on balloon click, not on icon left click. So, I am thinking how to simulate icon left click when user made click on balloon. However, CMainFrame::On0Restore code is not ok. I guess that code should work as expected. And is not happen.
You've been saying consistently that you need the left button on the tray icon to work. The balloon code works for me. Why are you saying On0Restore is not ok?
I guess I found the miss understanding here: I need to be functional the left click on tray balloon, not left click on the icon.
So, let say we have the same call to CMainFrame::On0Restore method on icon left click and on balloon left click, ok ?
When I call CMainFrame::On0Restore from left click button, the MDI window activation is correct, because NNN app has the focus already.
When I call CMainFrame::On0Restore from left click on balloon, the MDI window activation is NOT correct, because MDI is not gain the focus. Here is the issue.
Last edited by mesajflaviu; August 10th, 2020 at 10:44 AM.
And did you tried that code by clicking on tray balloon ? And when you tried this code have you started the application not from Visual Studio debugger but from Windows Explorer ?
void CMainFrame::On0Restore()
{
// TODO: Add your command handler code here
ShowWindow(SW_RESTORE);
SetForegroundWindow();
}
The code from above is not working if the app NNN is started from Windows Explorer and is activated through left click on balloon (not on icon left click)
Last edited by mesajflaviu; August 11th, 2020 at 04:53 AM.
I guess you should investigate the difference between starting the .exe from VS and from Explorer. And how is this problem related to the tray...
Sorry, I have currently a lot of work, so cannot help you more.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.