diff --git a/examples/example_dx11_hook/dllmain.cpp b/examples/example_dx11_hook/dllmain.cpp index d9de5bc..dd0c406 100644 --- a/examples/example_dx11_hook/dllmain.cpp +++ b/examples/example_dx11_hook/dllmain.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND, UINT, WPARAM, LPARAM); @@ -135,9 +136,8 @@ BOOL WINAPI DllMain(const HINSTANCE h_instance, const DWORD reason, LPVOID) if (reason == DLL_PROCESS_ATTACH) { DisableThreadLibraryCalls(h_instance); - CreateThread( - nullptr, 0, - [](LPVOID) -> DWORD + std::thread( + []() { while (!GetModuleHandle("d3d11.dll")) Sleep(100); @@ -147,8 +147,8 @@ BOOL WINAPI DllMain(const HINSTANCE h_instance, const DWORD reason, LPVOID) mgr.set_on_resize_buffers(on_resize_buffers); std::ignore = mgr.hook_dx11(); return 0; - }, - nullptr, 0, nullptr); + }) + .detach(); } else if (reason == DLL_PROCESS_DETACH) {