I have developed a server using nodejs, now I need to capture console minimization events, hidden to the tray, please tell me how to do that, thank you very much
I wrote a c++ plugin through the nodejs napi, but couldn't catch the minimization events.
Here is the code for my NAPI:
WNDCLASSEX *wc = (WNDCLASSEX *)calloc(1, sizeof(WNDCLASSEX));
wc->cbSize = sizeof(WNDCLASSEX);
wc->hInstance = GetModuleHandle(NULL);
wc->lpszClassName = lpWindowName;
wc->lpfnWndProc = WndProc;
wc->hCursor = LoadCursor(NULL, IDC_ARROW);
wc->hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc->style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wc->hIcon = LoadIcon(NULL, IDI_APPLICATION);
if (!RegisterClassEx(wc))
{
printf("Unable to register windows class.");
return false;
}
hwnd = CreateWindowEx(NULL,
lpWindowName, // window class name
NULL, // window caption
WS_OVERLAPPEDWINDOW, //
CW_USEDEFAULT, // initial x position
CW_USEDEFAULT, // initial y position
CW_USEDEFAULT, // initial x size
CW_USEDEFAULT, // initial y size
NULL, // parent window handle
NULL, // window menu handle
0, // program instance handle
NULL); // creation parameters
// ShowWindow(hwnd, SW_HIDE);
if (hwnd == NULL)
{
fprintf(stderr, "CreateWindow failed. Error: 0x%x\n", GetLastError());
return 0;
}
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;