| |

VerySource

 Forgot password?
 Register
Search
View: 3306|Reply: 28

Right-click, occasionally the tray system menu and its own pop-up menu will be displayed at the same time. How to solve

[Copy link]

2

Threads

15

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 United States

Post time: 2020-1-4 10:30:01
| Show all posts |Read mode
There is no problem in a case. The program displays an icon in the tray area. Right-click on the icon to bring up a pop-up menu designed by the program and all functions are normal.
However, occasionally, the system menu of the tray itself will pop up occasionally (same: right-clicking the menu on the tray time), and it will cause the right-click menu of my program to lose focus, but not disappear.

How to solve it? Do you want to filter out the system menu of the tray itself? How to filter?
Try this:
// filter system menu
HWND hTray = FindWindow (TEXT ("Shell_TrayWnd"), NULL);
hTray = FindWindowEx (hTray, NULL, TEXT ("TrayNotifyWnd"), NULL);
DestroyMenu (GetMenu (hTray));
hTray = NULL;
But no.

Please expert guidance, appreciate it! !!
Reply

Use magic Report

0

Threads

57

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-4 11:18:01
| Show all posts
When you click the right button, your icon has been moved by you, such as delete, add
Reply

Use magic Report

1

Threads

15

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-1-5 02:24:01
| Show all posts
It's the operating system's problem, not yours.
Reply

Use magic Report

0

Threads

10

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-5 09:48:01
| Show all posts
jobs
Reply

Use magic Report

1

Threads

15

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-1-5 10:15:01
| Show all posts
Yes, it is a problem with the operating system. This problem is encountered a lot. For example, the volume is sometimes clicked several times. I can't turn it off with any click.
Reply

Use magic Report

2

Threads

15

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

 Author| Post time: 2020-1-5 17:30:01
| Show all posts
It should not be a system problem. For example, this is not the case with Kaspersky's tray icon. I have tried it N times ...
Reply

Use magic Report

0

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 Australia

Post time: 2020-1-27 16:54:01
| Show all posts
LPPOINT point = new tagPOINT;
GetCursorPos (point);
...
delete point;

Try it with this line of code.
Reply

Use magic Report

0

Threads

57

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-28 11:09:01
| Show all posts
After popup menu
PostMessage (0)
Reply

Use magic Report

2

Threads

15

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

 Author| Post time: 2020-7-14 13:45:01
| Show all posts
PostMessage(0)
===============
How to use this, the compiler can not pass. I am SDK programming.
Whether: PostMessage(m_nid.hWnd, 0, 0, 0);
Reply

Use magic Report

0

Threads

57

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 Invalid IP Address

Post time: 2020-7-21 22:15:01
| Show all posts
To correct the first behavior, you need to make the current window the foreground window before calling TrackPopupMenu or TrackPopupMenuEx.

The second problem is caused by a problem with TrackPopupMenu. It is necessary to force a task switch to the application that called TrackPopupMenu at some time in the near future. This can be accomplished by posting a benign message to the window or thread.

The following code will take care of all of this:

    SetForegroundWindow(hDlg);

    // Display the menu
    TrackPopupMenu( hSubMenu,
                    TPM_RIGHTBUTTON,
                    pt.x,
                    pt.y,
                    0,
                    hDlg,
                    NULL);

    PostMessage(hDlg, WM_NULL, 0, 0);
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list