#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello, world\n");
return 0;
}
//
// 注入钩子,截获系统消息。
hHook = ::SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)WindowProc, hInstance, GetCurrentThreadId());
//
LRESULT CALLBACK WindowProc(int nCode, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WindowProc(int nCode, WPARAM wParam, LPARAM lParam)//
{
CWPSTRUCT* pMsg = (CWPSTRUCT*)(lParam);
if (pMsg->message == WM_CREATE)
{
HWND hWnd = ::FindWindow(NULL, L"ScreenWings");
if (hWnd)
{
CRect rc;
::GetWindowRect(hWnd, &rc); //获取窗口矩形(大小)
CPoint ptVertex[4]; //多边形顶点数组,形状为平行四边形
ptVertex[0].x = 0 ;
ptVertex[0].y = 90;
ptVertex[1].x = 1;
ptVertex[1].y = 90;
ptVertex[2].x = 1;
ptVertex[2].y = 89;
ptVertex[3].x = 0;
ptVertex[3].y = 89;
CRgn m_rgn; //定义窗口显示区域
m_rgn.CreatePolygonRgn(ptVertex, 4, ALTERNATE);//根据顶点数组创建窗口的显示区域
::SetWindowRgn(hWnd, m_rgn, TRUE);//添加到当前窗口
//ShowInTaskbar(pMsg->hwnd, FALSE);
}
}
else if (pMsg->message == WM_WINDOWPOSCHANGING)
{
if (pMsg->hwnd)
{
WCHAR szClassName[256];
::GetClassName(pMsg->hwnd, szClassName, 256);
CString strClassName = szClassName;
if (strClassName == L"WindowsForms10.Window.8.app.0.141b42a_r41_ad1")
{
OnTrayNotify(FindTrayWnd());
OnTrayNotify(FindNotifyIconOverflowWindow());
}
}
}
return CallNextHookEx(hHook, nCode, wParam, lParam);
}