MCPcopy Create free account
hub / github.com/DentonW/DevIL / WinMain

Function WinMain

DevIL/examples/windows_example/WindowsTest.cpp:111–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109
110
111int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
112{
113 MSG msg;
114 WNDCLASSEX wcex;
115 HACCEL hAccelTable;
116
117 hInstance = hInst;
118 memset(OpenFileName, 0, 2048 * sizeof(TCHAR));
119
120 BackBrush = CreateSolidBrush(RGB(128,128,128));
121
122 wcex.cbSize = sizeof(WNDCLASSEX);
123 wcex.style = CS_HREDRAW | CS_VREDRAW;
124 wcex.lpfnWndProc = (WNDPROC)WndProc;
125 wcex.cbClsExtra = 0;
126 wcex.cbWndExtra = 0;
127 wcex.hInstance = hInstance;
128 wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
129 wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
130 wcex.hbrBackground = BackBrush;
131 wcex.lpszMenuName = (LPCWSTR)IDR_MENU1; //@TODO: (LPCSTR)IDR_MENU1;
132 wcex.lpszClassName = TITLE;
133 wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_ICON1);
134
135 RegisterClassEx(&wcex);
136
137 HWnd = CreateWindow(TITLE, TITLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
138 50, 50, 400, 300, NULL, NULL, hInstance, NULL);
139 if (HWnd == NULL)
140 return FALSE;
141
142 //if (SDL_Init(SDL_INIT_TIMER) < 0)
143 // return FALSE;
144 //atexit(SDL_Quit);
145
146 // Display the window
147 ShowWindow(HWnd, nCmdShow);
148 UpdateWindow(HWnd);
149
150 // Initialize DevIL
151 ilInit();
152 iluInit();
153 ilutRenderer(ILUT_WIN32);
154
155 // Is there a file to load from the command-line?
156 if (__argc > 1) {
157 ilGenImages(1, Undos);
158 ilBindImage(Undos[0]);
159 /*if (ilLoadImage(__argv[1])) {
160 CurImage = 0;
161 //ilConvertImage(IL_BGRA);
162 ilutRenderer(ILUT_WIN32);
163 ResizeWin();
164 CreateGDI();
165 sprintf(NewTitle, "%s - %s", TITLE, __argv[1]);
166 SetWindowText(HWnd, NewTitle);
167 }*/
168 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected