justinstenning / Direct3DHook

DirectX Capture and Overlays by using Direct3D API hooks
http://spazzarama.com/2011/03/14/c-screen-capture-and-overlays-for-direct3d-9-10-and-11-using-api-hooks
MIT License
582 stars 176 forks source link

Why i can't use breakpoints on the Capture project in the namespace Capture.Hook ? #13

Closed Csharper1972 closed 10 years ago

Csharper1972 commented 10 years ago

For example i added some breakpoints in the Capture project in the FramesPerSecond.cs but when i'm running the program what i'm doing it never stop at this breakpoints. If i'm adding breakpoints to the Interface part of the Capture project it does get and stop at this breakpoints.

Any ideas why it never stop at the FramesPerSecond.cs ? And can i fix it ?

Just to mention if it's any important i'm running the program as admin.

justinstenning commented 10 years ago

Could you please outline how you are trying to debug the target application?

You need to attach the the debugger to the application you are hooking - ensuring to select both Managed and Native.

Csharper1972 commented 10 years ago

spazzarama Hi,

I just downloaded the zip file here i didn't change anything and just added some breakpoints on some lines in FramesPerSecond.cs but it never get there. Could you maybe connect my pc for second with teamviwer to see on my pc how it's working ? I'm trying to hook a game and i can get screenshots no problems. And i'm using your zip file there is the dll Capture project and the TestScreenshot project. I'm running the TestScreenshot project and added breakpoints to the Capture project but only under Hook it's not working. Breakpoints under Interface do work.

justinstenning commented 10 years ago

You have to attach the debugger to the game you are hooking. It is easiest to then run TestScreenshot from outside the debugger.

Csharper1972 commented 10 years ago

Did you manage to use breakpoints for example in FramesPerSecond.cs ?

Csharper1972 commented 10 years ago

How do you attach the debugger to the game you hook ? From the visual studio options or it should be in the project options ?

Csharper1972 commented 10 years ago

Ok i did in the visual studio menu: DEBUG > Attach to process and attached it to the game i try to hook now it's running the program automatic but nothing happen. It's just saying running and that's it. It didn't stop on the breakpoints and i don't see the program menu nothing it's just saying running.

justinstenning commented 10 years ago

To debug the target application/game:

  1. Have your solution open in Visual Studio
  2. Attach to the process with Debug -> Attach to Process...
  3. Select the correct process, and ensure that both managed and native code is enabled. image
  4. Run TestScreenshot from Windows Explorer and inject into target process
Csharper1972 commented 10 years ago

Great. It's working. Thank you very much for the help.