eugen15 / directx-present-hook

The project shows how to hook IDXGISwapChain::Present and capture window frames.
MIT License
34 stars 10 forks source link

Hooking IDXGISwapChain::Present in another process #1

Open Linside opened 2 years ago

Linside commented 2 years ago

Hi, The example works well, it is very useful for me! Now I'm considering to capture window of other processes, and made some changes to test:

  // Set the hook object to capture some frames.
  hr = HookT::Get()->CaptureFrames(blackBoxDXWindow.GetHandle(), outputFolder, 10);

to

  // Set the hook object to capture some frames, but for another window.
  HWND hwnd = FindWindowW(NULL, L"Another Window");
  hr = HookT::Get()->CaptureFrames(hwnd, outputFolder, 10);

I'm using dx11 and I found the D3D11PresentHook::SwapChainPresent function still only catching the swapchain of the blackbox window created by its own. I have noticed that the address of presentPointer_ in D3D11PresentHook::Hook is always the same, so I supposed the polyhook will work like some global hook of SetWindowsHook, but it's seems not. And now I think the problem is cross-process, do you have any idea of this issue or I missed up something?

timercrack commented 1 year ago

I have the same question! Can't hooking another process!