summaryrefslogtreecommitdiff
path: root/src/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/win32.c')
-rw-r--r--src/win32.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/win32.c b/src/win32.c
new file mode 100644
index 00000000..1cdcf34c
--- /dev/null
+++ b/src/win32.c
@@ -0,0 +1,18 @@
1#include "win32.h"
2#include <SDL_syswm.h>
3
4#define WIN32_LEAN_AND_MEAN
5#include <Windows.h>
6
7void useExecutableIconResource_SDLWindow(SDL_Window *win) {
8 HINSTANCE handle = GetModuleHandle(NULL);
9 HICON icon = LoadIcon(handle, "IDI_ICON1");
10 if (icon) {
11 SDL_SysWMinfo wmInfo;
12 SDL_VERSION(&wmInfo.version);
13 if (SDL_GetWindowWMInfo(win, &wmInfo)) {
14 HWND hwnd = wmInfo.info.win.window;
15 SetClassLongPtr(hwnd, -14 /*GCL_HICON*/, (LONG_PTR) icon);
16 }
17 }
18}