Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MainWindow::MainWindow(HINSTANCE hInstance, int nCmdShow) {
- //register window class
- ZeroMemory(&wc, sizeof(wc));
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = 0;
- wc.lpfnWndProc = WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = "MainWindow";
- wc.hIcon = NULL;
- wc.hIconSm = NULL;
- if(!RegisterClassEx(&wc)) {
- MessageBox(NULL, "Window Registration Failed!", "Error", MB_ICONEXCLAMATION|MB_OK);
- exit(0);
- }
- //create dependancies
- font = CreateFont(-11, 0, 0, 0, 400, FALSE, FALSE, FALSE, 1, 400, 0, 0, 0, ("Ms Shell Dlg"));
- HMENU hMainMenu = CreateMenu();
- HMENU hFileMenu = CreatePopupMenu();
- AppendMenu(hMainMenu, MF_STRING|MF_POPUP|MF_MENUBREAK, (UINT_PTR)hFileMenu, ("File"));
- AppendMenu(hFileMenu, MF_STRING, 301, ("New Game"));
- AppendMenu(hFileMenu, MF_STRING, 302, ("Save Game"));
- AppendMenu(hFileMenu, MF_STRING, 303, ("Load Game"));
- AppendMenu(hFileMenu, MF_STRING, 304, ("Quit"));
- HMENU hHelpMenu = CreatePopupMenu();
- AppendMenu(hMainMenu, MF_STRING|MF_POPUP|MF_MENUBREAK, (UINT_PTR)hHelpMenu, ("Help"));
- AppendMenu(hHelpMenu, MF_STRING, 305, ("About"));
- //create window and populate controls
- main_win = CreateWindowEx(WS_EX_DLGMODALFRAME, "MainWindow", "Landing Party", WS_CAPTION|WS_POPUPWINDOW, 200, 200, 741, 555, 0, hMainMenu, hInstance, 0);
- HWND hCtrlStcDisplay = CreateWindowEx(WS_EX_STATICEDGE, WC_STATIC, (""), WS_VISIBLE | WS_CHILD | WS_GROUP | SS_LEFT, 6, 7, 600, 465, main_win, (HMENU)201, hInstance, 0);
- SendMessage(hCtrlStcDisplay, WM_SETFONT, (WPARAM)font, FALSE);
- HWND hCtrlBtnFire = CreateWindowEx(0, WC_BUTTON, ("Open Fire"), WS_VISIBLE | WS_CHILD | WS_TABSTOP, 623, 29, 98, 33, main_win, (HMENU)202, hInstance, 0);
- SendMessage(hCtrlBtnFire, WM_SETFONT, (WPARAM)font, FALSE);
- HWND hCtrlBtnPunch = CreateWindowEx(0, WC_BUTTON, ("Hand-to-Hand"), WS_VISIBLE | WS_CHILD | WS_TABSTOP, 623, 68, 98, 33, main_win, (HMENU)204, hInstance, 0);
- SendMessage(hCtrlBtnPunch, WM_SETFONT, (WPARAM)font, FALSE);
- HWND hCtrlBtnTalk = CreateWindowEx(0, WC_BUTTON, ("Negotiate"), WS_VISIBLE | WS_CHILD | WS_TABSTOP, 623, 107, 98, 33, main_win, (HMENU)203, hInstance, 0);
- SendMessage(hCtrlBtnTalk, WM_SETFONT, (WPARAM)font, FALSE);
- HWND hCtrlBtnFlee = CreateWindowEx(0, WC_BUTTON, ("Flee"), WS_VISIBLE | WS_CHILD | WS_TABSTOP, 623, 146, 98, 33, main_win, (HMENU)205, hInstance, 0);
- SendMessage(hCtrlBtnFlee, WM_SETFONT, (WPARAM)font, FALSE);
- HWND hCtrlStcParty = CreateWindowEx(0, WC_BUTTON, ("Party"), WS_VISIBLE | WS_CHILD | 0x00000007, 614, 195, 116, 278, main_win, (HMENU)206, hInstance, 0);
- SendMessage(hCtrlStcParty, WM_SETFONT, (WPARAM)font, FALSE);
- HWND hCtrlStcCmds = CreateWindowEx(0, WC_BUTTON, ("Commands"), WS_VISIBLE | WS_CHILD | 0x00000007, 614, 7, 116, 182, main_win, (HMENU)207, hInstance, 0);
- SendMessage(hCtrlStcCmds, WM_SETFONT, (WPARAM)font, FALSE);
- HWND hCtrlProgress = CreateWindowEx(0, PROGRESS_CLASS, 0, WS_VISIBLE | WS_CHILD, 6, 478, 725, 24, main_win, (HMENU)208, hInstance, 0);
- SendMessage(hCtrlProgress, WM_SETFONT, (WPARAM)font, FALSE);
- ShowWindow(main_win, nCmdShow);
- UpdateWindow(main_win);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement