diff options
Diffstat (limited to 'Source/Main.cpp')
-rw-r--r-- | Source/Main.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/Source/Main.cpp b/Source/Main.cpp index 8a7a5bb..0081808 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | HINSTANCE hInst; | 16 | HINSTANCE hInst; |
17 | WCHAR szWindowClass[MAX_LOADSTRING]; | 17 | WCHAR szWindowClass[MAX_LOADSTRING]; |
18 | HWND hwndSeed; | 18 | HWND hwndSeed, hwndRandomize; |
19 | 19 | ||
20 | // Forward declares | 20 | // Forward declares |
21 | ATOM MyRegisterClass(HINSTANCE hInstance); | 21 | ATOM MyRegisterClass(HINSTANCE hInstance); |
@@ -67,26 +67,23 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) | |||
67 | 67 | ||
68 | WCHAR szTitle[MAX_LOADSTRING]; | 68 | WCHAR szTitle[MAX_LOADSTRING]; |
69 | LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); | 69 | LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); |
70 | HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, | 70 | HWND hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, |
71 | CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, hInstance, nullptr); | 71 | 400, 200, 500, 500, nullptr, nullptr, hInstance, nullptr); |
72 | 72 | ||
73 | if (!hWnd) | 73 | if (!hWnd) return FALSE; |
74 | { | ||
75 | return FALSE; | ||
76 | } | ||
77 | 74 | ||
78 | LoadLibrary(L"Msftedit.dll"); | 75 | LoadLibrary(L"Msftedit.dll"); |
79 | HWND label = CreateWindow(L"BUTTON", L"Enter a seed:", | 76 | HWND label = CreateWindow(L"STATIC", L"Enter a seed:", |
80 | WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, | 77 | WS_TABSTOP | WS_VISIBLE | WS_CHILD | SS_LEFT, |
81 | 10, 10, 100, 26, hWnd, NULL, hInst, NULL); | 78 | 10, 15, 90, 16, hWnd, NULL, hInst, NULL); |
82 | 79 | ||
83 | hwndSeed = CreateWindowEx(0, MSFTEDIT_CLASS, L"", | 80 | hwndSeed = CreateWindowEx(0, MSFTEDIT_CLASS, L"", |
84 | ES_MULTILINE | WS_VISIBLE | WS_CHILD | WS_BORDER | WS_TABSTOP, | 81 | WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER, |
85 | 120, 10, 50, 26, hWnd, NULL, hInst, NULL); | 82 | 100, 10, 50, 26, hWnd, NULL, hInst, NULL); |
86 | 83 | ||
87 | HWND hwndRandomize = CreateWindow(L"BUTTON", L"Randomize", | 84 | hwndRandomize = CreateWindow(L"BUTTON", L"Randomize", |
88 | WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, | 85 | WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, |
89 | 180, 10, 100, 26, hWnd, (HMENU)IDC_RANDOMIZE, hInst, NULL); | 86 | 160, 10, 100, 26, hWnd, (HMENU)IDC_RANDOMIZE, hInst, NULL); |
90 | 87 | ||
91 | HDC hdc = GetDC(hWnd); | 88 | HDC hdc = GetDC(hWnd); |
92 | RECT rect; | 89 | RECT rect; |
@@ -122,6 +119,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) | |||
122 | } | 119 | } |
123 | srand(seed); | 120 | srand(seed); |
124 | Randomizer().Randomize(); | 121 | Randomizer().Randomize(); |
122 | SetWindowText(hwndRandomize, L"Randomized!"); | ||
125 | } | 123 | } |
126 | } | 124 | } |
127 | return DefWindowProc(hWnd, message, wParam, lParam); | 125 | return DefWindowProc(hWnd, message, wParam, lParam); |