LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (ImGui_ImplDX11_WndProcHandler(hWnd, msg, wParam, lParam)) return true; switch (msg) { case WM_SIZE: { if (wParam != SIZE_MINIMIZED) { Director::getInstance()->onResize(static_cast<unsigned int>(LOWORD(lParam)), static_cast<unsigned int>(HIWORD(lParam))); } return 0; } case WM_SYSCOMMAND: { if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu return 0; break; } case WM_DESTROY: { PostQuitMessage(0); return 0; } } return DefWindowProc(hWnd, msg, wParam, lParam); }
static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (ImGui_ImplDX11_WndProcHandler(hWnd, msg, wParam, lParam)) { return 1; } switch (msg) { case WM_SIZE: if (RendererIsInit() && wParam != SIZE_MINIMIZED) { int windowWidth = (int)LOWORD(lParam); int windowHeight = (int)HIWORD(lParam); int renderWidth = windowWidth; int renderHeight = windowHeight; RendererResize(windowWidth, windowHeight, renderWidth, renderHeight); } case WM_SYSCOMMAND: if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu return 0; break; case WM_CLOSE: g_App.bShouldClose = true; return 0; } return DefWindowProcW(hWnd, msg, wParam, lParam); }
LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (ImGui_ImplDX11_WndProcHandler(hWnd, msg, wParam, lParam)) return true; switch (msg) { case WM_SIZE: if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED) { ImGui_ImplDX11_InvalidateDeviceObjects(); CleanupRenderTarget(); g_pSwapChain->ResizeBuffers(0, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam), DXGI_FORMAT_UNKNOWN, 0); CreateRenderTarget(); ImGui_ImplDX11_CreateDeviceObjects(); } return 0; case WM_SYSCOMMAND: if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu return 0; break; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hWnd, msg, wParam, lParam); }
LRESULT MySample_WndProcCallback(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { extern IMGUI_API LRESULT ImGui_ImplDX11_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT r = ImGui_ImplDX11_WndProcHandler(hWnd, msg, wParam, lParam); if (msg == WM_MOUSEWHEEL || msg == WM_MOUSEMOVE) return ImGui::GetIO().WantCaptureMouse ? r : 0; if (msg == WM_KEYDOWN || msg == WM_KEYUP || msg == WM_KEYFIRST) return ImGui::GetIO().WantCaptureKeyboard ? r : 0; return 0; }
LRESULT WINAPI DetourDefWindowProc( _In_ HWND hWnd, _In_ UINT Msg, _In_ WPARAM wParam, _In_ LPARAM lParam ) { static boost::once_flag flag = BOOST_ONCE_INIT; boost::call_once(flag, boost::bind(&logOnce, "++ USER32!DefWindowProc called")); if (!g_hWnd) { g_hWnd = hWnd; } ImGui_ImplDX9_WndProcHandler(hWnd, Msg, wParam, lParam); ImGui_ImplDX10_WndProcHandler(hWnd, Msg, wParam, lParam); ImGui_ImplDX11_WndProcHandler(hWnd, Msg, wParam, lParam); return OriginalDefWindowProc(hWnd, Msg, wParam, lParam); }
bool CImGuiModule::onSysMsg(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { return ImGui_ImplDX11_WndProcHandler(hWnd, message, wParam, lParam) ? true : false; }