int main(int argc, char *argv[]) { DWORD tid; HINSTANCE hInstance = GetModuleHandle(NULL); trayicon_init(LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPICON)), APPNAME); trayicon_add_item(NULL, &toggleBypassMode); trayicon_add_item("Exit", &exitApplication); HANDLE thread = CreateThread(0, 0, hookThreadMain, argv[0], 0, &tid); MSG msg; while (GetMessage(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; top_window = GetForegroundWindow(); trayicon_init(LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPICON)), APPNAME); trayicon_add_item(NULL, &toggleWindowVisible); trayicon_add_item("Exit", &exitApplication); main_window = createMainWindow(hInstance); SetTimer(main_window, 1, 500, NULL); is_visible = false; while (GetMessage(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int)msg.wParam; }