ui/win32/window.c

changeset 666
86c3f109ed3b
parent 627
3f0c9fe60c68
child 813
6d9066951cdb
equal deleted inserted replaced
665:73689d24080c 666:86c3f109ed3b
37 #include <stdlib.h> 37 #include <stdlib.h>
38 38
39 39
40 static HINSTANCE hInstance; 40 static HINSTANCE hInstance;
41 41
42 static const wchar_t *mainWindowClass = L"UiMainWindow"; 42 static const char *mainWindowClass = "UiMainWindow";
43 43
44 LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { 44 LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
45 switch(uMsg) { 45 switch(uMsg) {
46 case WM_DESTROY: 46 case WM_DESTROY:
47 PostQuitMessage(0); 47 PostQuitMessage(0);
60 wc.hInstance = hInstance; 60 wc.hInstance = hInstance;
61 wc.lpszClassName = mainWindowClass; 61 wc.lpszClassName = mainWindowClass;
62 wc.hCursor = LoadCursor(NULL, IDC_ARROW); 62 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
63 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 63 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
64 64
65 if(!RegisterClassEx(&wc)) { 65 if(!RegisterClassExA(&wc)) {
66 MessageBox(NULL, "RegisterClassEx failed", "Error", MB_ICONERROR); 66 MessageBox(NULL, "RegisterClassEx failed", "Error", MB_ICONERROR);
67 exit(-1); 67 exit(-1);
68 } 68 }
69 } 69 }
70 70
71 static UiObject* create_window(const char *title, void *window_data, bool simple) { 71 static UiObject* create_window(const char *title, void *window_data, bool simple) {
72 UiObject *obj = uic_object_new_toplevel(); 72 UiObject *obj = uic_object_new_toplevel();
73 obj->window = window_data; 73 obj->window = window_data;
74 74
75 HWND hwnd = CreateWindowEx( 75 HWND hwnd = CreateWindowExA(
76 0, 76 0,
77 L"UiMainWindow", 77 "UiMainWindow",
78 "Test", 78 title,
79 WS_OVERLAPPEDWINDOW | WS_VISIBLE, 79 WS_OVERLAPPEDWINDOW | WS_VISIBLE,
80 CW_USEDEFAULT, 80 CW_USEDEFAULT,
81 CW_USEDEFAULT, 81 CW_USEDEFAULT,
82 800, 82 800,
83 600, 83 600,

mercurial