当前位置:网站首页>C calls SendMessage to refresh the taskbar icon (the icon does not disappear at the end of forcing)

C calls SendMessage to refresh the taskbar icon (the icon does not disappear at the end of forcing)

2020-11-06 21:24:50 Irving the procedural ape

In this paper, the reference C++ rewrite  https://blog.csdn.net/dpsying/article/details/20139651  ( There are misunderstandings about the coordinates of this article , It will lead to invalid function )

SendMessage Move the coordinates in the mouse It's based on the inside of the handle coordinate , It's not screen coordinates , Taskbar width 300 Fixed height 40, So it should be from the width 0-300 coordinate 15 Between Move past .

First state what you need to use winapi function

1   [DllImport("user32.dll", EntryPoint = "FindWindow")] 2   private static extern int FindWindow(string lpszClass, string lpszWindow); 3   [DllImport("user32.dll", EntryPoint = "FindWindowEx")] 4   private static extern int FindWindowEx(int hwndParent, int hwndChildAfter, string lpszClass, string lpszWindow); 5  6   [DllImport("user32.dll", EntryPoint = "GetWindowRect")] 7   private static extern int GetWindowRect(int hwnd, ref System.Drawing.Rectangle lpRect); 8   [DllImport("user32.dll", EntryPoint = "SendMessage")] 9   private static extern int SendMessage(int hwnd, int wMsg, int wParam, int lParam);10 11   private static readonly int WM_MOUSEMOVE = 512;
winapi

Encapsulate the called process method

版权声明
本文为[Irving the procedural ape]所创,转载请带上原文链接,感谢