summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/context_dxinterop.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl/context_dxinterop.c')
-rw-r--r--video/out/opengl/context_dxinterop.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/video/out/opengl/context_dxinterop.c b/video/out/opengl/context_dxinterop.c
index 4dfc3c2108..a4dc165132 100644
--- a/video/out/opengl/context_dxinterop.c
+++ b/video/out/opengl/context_dxinterop.c
@@ -27,6 +27,9 @@
// For WGL_ACCESS_WRITE_DISCARD_NV, etc.
#include <GL/wglext.h>
+EXTERN_C IMAGE_DOS_HEADER __ImageBase;
+#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
+
// mingw-w64 header typo?
#ifndef IDirect3DSwapChain9Ex_GetBackBuffer
#define IDirect3DSwapChain9Ex_GetBackBuffer IDirect3DSwapChain9EX_GetBackBuffer
@@ -99,7 +102,7 @@ static int os_ctx_create(struct MPGLContext *ctx)
.cbSize = sizeof(WNDCLASSEXW),
.style = CS_OWNDC,
.lpfnWndProc = DefWindowProc,
- .hInstance = GetModuleHandleW(NULL),
+ .hInstance = HINST_THISCOMPONENT,
.lpszClassName = os_wnd_class,
});
@@ -107,7 +110,7 @@ static int os_ctx_create(struct MPGLContext *ctx)
// possible to use the VO window, but MSDN recommends against drawing to
// the same window with flip mode present and other APIs, so play it safe.
p->os_wnd = CreateWindowExW(0, os_wnd_class, os_wnd_class, 0, 0, 0, 200,
- 200, NULL, NULL, GetModuleHandleW(NULL), NULL);
+ 200, NULL, NULL, HINST_THISCOMPONENT, NULL);
p->os_dc = GetDC(p->os_wnd);
if (!p->os_dc) {
MP_FATAL(ctx->vo, "Couldn't create window for offscreen rendering\n");