ID:48987
 
I've been stumbling around in the figurative dark for a while now, trying to understand the process of hooking a direct X screen. Specifically, I want to hook BYOND's screen so that I can draw on it from C# and XNA.

But delving too deep into scarcely charted shafts of knowledge gets pretty convoluted pretty fast, and unfortunately I've got a slew of priorities to attend before I can really sink my teeth into the mysteries of the various libraries and demonstrations I've downloaded.

In my frustration I wanted to find a sanity check that would prove that hooking BYOND's screen could actually be done. I then remembered FRAPS, and decided to give it a shot. And lo' and behold -- it works!

So it's possible. (As suggested by a certain BYOND member in the developer forums). But what's the simplest way to go about what I'm trying to do?

I understand I need a dll in unmanaged code (C++, more than likely), and that that dll needs to supply the functions for the actual hooking. However, a dll can't be launched by byond. So it would have to launch a program to launch the dll.

Additionally, I'm assuming the program would have to launch the dll so that it would inject itself into the BYOND's process space. This means further complication.

So the theoretical model looks like this:

BYOND app/game -> C# exec -> C++ dll

Now another problem becomes, how do I push the C# XNA direct X screen through the C++ dll and back to the BYOND app/game?

BYOND app/game <- C# exec <- C++ dll

Any ideas, suggestions, examples, or links welcome!

A DLL can be launched by BYOND (using the call() function - the ability was added in recent versions), but there's a possibility you might have to load the hooking DLL before BYOND itself is loaded.

For DX hooking, try reading this post at Gamedev. I've never tried it, but it seems possible.
Hobnob wrote:
A DLL can be launched by BYOND (using the call() function - the ability was added in recent versions), but there's a possibility you might have to load the hooking DLL before BYOND itself is loaded.

For DX hooking, try reading this post at Gamedev. I've never tried it, but it seems possible.

Hmmm, I've been using BYOND off and on for quite a few years so I'm not surprised I missed this development. The idea of using dlls with BYOND really makes me excited in the most geeky of ways.

Thanks for the link, I'll check it out and comment later.
Well I had time to read the article, download the sample application, and run it, but it fails to work for whatever reason with a byond game I tested it on.

The console app says it installed the hook, but it's not showing anything on the BYOND screen, so I'm guessing it failed.

Could this be vista related? Would I have to enable something for it to work?