15,979
社区成员
发帖
与我相关
我的任务
分享
#pragma warning(disable:4996);//关闭“可能不安全的代码”警告,如果不关闭,程序无法运行;
ATOM MyRegisterClass(PWNDCLASSEX,HINSTANCE);
HWND InitInstance(HINSTANCE, int);
BOOL ScreenShot(HDC, POINT, POINT);
BOOL GetFileName(PTCHAR);
NOTIFYICONDATA g_nid;
HINSTANCE g_hInstance;
HWND g_hWnd;
BOOL g_State = FALSE;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HWND hWndPre;
if(hWndPre = FindWindow("MYSCREENSHOT", 0))
// SendMessage(hWndPre, WM_DESTROY, 0, 0);
ExitProcess(0);
g_hInstance = hInstance;
HWND hWnd;
MSG msg;
WNDCLASSEX WndClass;
MyRegisterClass(&WndClass, hInstance);
if (!(hWnd = InitInstance(hInstance, nCmdShow)))
return FALSE;
g_hWnd = hWnd;
g_nid.cbSize = sizeof(NOTIFYICONDATA);
g_nid.hWnd = hWnd;
g_nid.uID = 0;
g_nid.uFlags = NIF_ICON | NIF_MESSAGE |NIF_TIP;
g_nid.uCallbackMessage = MY_ICON_MESSAGE;
g_nid.hIcon = LoadIcon(hInstance,(LPCTSTR)IDI_OFF);
strcpy(g_nid.szTip, "TSKBAR");
Shell_NotifyIcon(NIM_ADD,&g_nid);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
注册wcex之后就会出现任务栏小图标了
那么闪烁消息就是使用透明的hIcon了(应该是,因为我们无法拆开微信的内核查看)