| 44 | // returns strdup() created pointer - callee assumes the ownership |
| 45 | |
| 46 | HWND |
| 47 | mswin_init_main_window(void) |
| 48 | { |
| 49 | static int run_once = 0; |
| 50 | HWND ret; |
| 51 | WINDOWPLACEMENT wp; |
| 52 | |
| 53 | /* register window class */ |
| 54 | if (!run_once) { |
| 55 | LoadString(GetNHApp()->hApp, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); |
| 56 | register_main_window_class(); |
| 57 | run_once = 1; |
| 58 | } |
| 59 | |
| 60 | /* create the main window */ |
| 61 | ret = |
| 62 | CreateWindow(szMainWindowClass, /* registered class name */ |
| 63 | szTitle, /* window name */ |
| 64 | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, /* window style */ |
| 65 | CW_USEDEFAULT, /* horizontal position of window */ |
| 66 | CW_USEDEFAULT, /* vertical position of window */ |
| 67 | CW_USEDEFAULT, /* window width */ |
| 68 | CW_USEDEFAULT, /* window height */ |
| 69 | NULL, /* handle to parent or owner window */ |
| 70 | NULL, /* menu handle or child identifier */ |
| 71 | GetNHApp()->hApp, /* handle to application instance */ |
| 72 | NULL /* window-creation data */ |
| 73 | ); |
| 74 | |
| 75 | if (!ret) |
| 76 | panic("Cannot create main window"); |
| 77 | |
| 78 | if (GetNHApp()->regMainMinX != CW_USEDEFAULT) { |
| 79 | wp.length = sizeof(wp); |
| 80 | wp.showCmd = GetNHApp()->regMainShowState; |
| 81 | |
| 82 | wp.ptMinPosition.x = GetNHApp()->regMainMinX; |
| 83 | wp.ptMinPosition.y = GetNHApp()->regMainMinY; |
| 84 | |
| 85 | wp.ptMaxPosition.x = GetNHApp()->regMainMaxX; |
| 86 | wp.ptMaxPosition.y = GetNHApp()->regMainMaxY; |
| 87 | |
| 88 | wp.rcNormalPosition.left = GetNHApp()->regMainLeft; |
| 89 | wp.rcNormalPosition.top = GetNHApp()->regMainTop; |
| 90 | wp.rcNormalPosition.right = GetNHApp()->regMainRight; |
| 91 | wp.rcNormalPosition.bottom = GetNHApp()->regMainBottom; |
| 92 | SetWindowPlacement(ret, &wp); |
| 93 | } else |
| 94 | ShowWindow(ret, SW_SHOWDEFAULT); |
| 95 | |
| 96 | UpdateWindow(ret); |
| 97 | return ret; |
| 98 | } |
| 99 | |
| 100 | void |
| 101 | register_main_window_class(void) |
no test coverage detected