| 361 | |
| 362 | |
| 363 | static LRESULT CALLBACK WindowFunc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
| 364 | { |
| 365 | /************************************** |
| 366 | * |
| 367 | * W i n d o w _ F u n c |
| 368 | * |
| 369 | ************************************** |
| 370 | * |
| 371 | * Functional description |
| 372 | * |
| 373 | * This function is where the windowing action takes place. |
| 374 | * Handle the various messages which come here from GetMessage. |
| 375 | * |
| 376 | **************************************/ |
| 377 | |
| 378 | static BOOL bInTaskBar = FALSE; |
| 379 | static bool bStartup = false; |
| 380 | static HINSTANCE hInstance = NULL; |
| 381 | static UINT s_uTaskbarRestart; |
| 382 | |
| 383 | hInstance = (HINSTANCE) GetWindowLongPtr(hWnd, GWLP_HINSTANCE); |
| 384 | switch (message) |
| 385 | { |
| 386 | case WM_CLOSE: |
| 387 | // Clean up memory for log_entry |
| 388 | while (log_entry->next) |
| 389 | { |
| 390 | log_info* tmp = log_entry->next; |
| 391 | free(log_entry); |
| 392 | log_entry = tmp; |
| 393 | } |
| 394 | free(log_entry); |
| 395 | DestroyWindow(hWnd); |
| 396 | break; |
| 397 | |
| 398 | case WM_COMMAND: |
| 399 | switch (wParam) |
| 400 | { |
| 401 | case IDM_CANCEL: |
| 402 | ShowWindow(hWnd, bInTaskBar ? SW_HIDE : SW_MINIMIZE); |
| 403 | return TRUE; |
| 404 | |
| 405 | case IDM_OPENPOPUP: |
| 406 | { |
| 407 | // The SetForegroundWindow() has to be called because our window |
| 408 | // does not become the Foreground one (inspite of clicking on |
| 409 | // the icon). This is so because the icon is painted on the task |
| 410 | // bar and is not the same as a minimized window. |
| 411 | |
| 412 | SetForegroundWindow(hWnd); |
| 413 | |
| 414 | HMENU hPopup = CreatePopupMenu(); |
| 415 | char szMsgString[256]; |
| 416 | LoadString(hInstance, IDS_SVRPROPERTIES, szMsgString, 256); |
| 417 | AppendMenu(hPopup, MF_STRING, IDM_SVRPROPERTIES, szMsgString); |
| 418 | LoadString(hInstance, IDS_SHUTDOWN, szMsgString, 256); |
| 419 | AppendMenu(hPopup, MF_STRING, IDM_SHUTDOWN, szMsgString); |
| 420 | LoadString(hInstance, IDS_PROPERTIES, szMsgString, 256); |
nothing calls this directly
no test coverage detected