Today I decided to release a correct version of an ImGui menu directly hooked into a directx11 application.

The sources are available here: https://github.com/Sh0ckFR/Universal-ImGui-D3D11-Hook

I did that because my goal was to add some menus in games like GTA5, but sources available on the net was not really user/developer-friendly.

My work is based on: https://github.com/Rebzzel/Universal-D3D11-Hook

I just fixed some issues, added ImGui and added the mouse / keyboard InputHook.

If you want to use it, you can compile the project (don’t forget to add MinHook and ImGui correctly) and inject your dll in the targeted directx10/11 application.

The most important part is in d3d11hook:

D3D11_HOOK_API void ImplHookDX11_Present(ID3D11Device *device, ID3D11DeviceContext *ctx, IDXGISwapChain *swap_chain)
if (GetAsyncKeyState(OpenMenuKey) & 0x1) {
menu->IsOpen ? menu->IsOpen = false : menu->IsOpen = true;


HRESULT __stdcall PresentHook(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags)
std::call_once(g_isInitialized, [&]() {
pSwapChain->GetDevice(__uuidof(g_pd3dDevice), reinterpret_cast(&g_pd3dDevice));

ImGui_ImplDX11_Init(g_hWnd, g_pd3dDevice, g_pd3dContext);

ImplHookDX11_Present(g_pd3dDevice, g_pd3dContext, g_pSwapChain);

return phookD3D11Present(pSwapChain, SyncInterval, Flags);

I suggest you to edit ImplHookDX11_Present only if you want to add your own code.

Have a good day 😉

One thought on “Universal-ImGui-D3D11-Hook

Leave a Reply

Your email address will not be published. Required fields are marked *