# Introduction

### What is DxWnd?

DxWnd is a Win32 hooker that intercepts and alters the behavior of window messages and APIs. It intercepts events and injects code into the configured tasks to run fullscreen programs in a windowed environment while maintaining proper behavior. Simply put, DxWnd is a tool that does its best to let you run fullscreen applications in a window.

DxWnd takes advantage of the hooked logic injected into the application to add a few more little tricks on top of this basic functionality, falling into two general categories: compatibility and time flow. The extra compatibility features often allow some old programs to run on modern platforms, and the time flow features allow you to increase or decrease the game speed at will. Have you always had trouble with first-person shooters? Turn the tables with bullet time whenever you need it!

### What is DxWnd for?

Let's start with the first one. Once upon a time (with computers, that means a few years ago), people used to have clumsy PCs that operated in a slow and single-threaded environment, trying their best to impress their owner with demonstrations of strength, usually by trying to move colored pixels on the screen in the fastest possible way. That custom was named video gaming, and involved many tricks to improve system performance. One common way to do that was to hijack all hardware resources and dedicate them to this single purpose, which of course disabled any attempt to run parallel tasks in other portions of the screen. The classic example is any videogame developed for Windows 95 and onward.

Now, you may be asking yourself why, after all this time, and with PCs so much more powerful, we have to keep playing these games in the very same environment. Someone is calling you in a chat program? A new email arrives? You want to browse the net? Something is happening on your favorite social network or MMPORPG? Forget about it! You're currently dealing with a task that wants 100% of your attention, even if it uses 1% of your PC's power. So, why not attempt to push this old and invasive application into a window of its own?

That's what DxWnd is mainly for: letting fullscreen applications run in their own separate window while pretending that they're still in a fullscreen context. The code hooking involved in this may even allow us to make further improvements, but we'll see this later.

A second certain fact is the technological evolution that has transitioned games from being built for specific Windows operating systems and CPU architectures using old and tricky DirectDraw support to using recent 3D libraries like Direct3D 8/9/10/11 and OpenGL. This evolution has left some victims behind: a lot of wonderful games are no longer supported in the current environment, despite Microsoft's efforts to support legacy programs. In some cases, DxWnd is crucial in recovering these old glories.

### Why develop DxWnd?

Now the second question: why should someone bother to develop a thing like this? This is a different story. I started looking for a window-izer for a specific purpose: not having a dual monitor PC at home, I was looking for a way to debug fullscreen videogames. With some Internet research, I found references to an Asian (Japanese?) DxWnd project that seemed discontinued, but left an old copy of the C++ source (unfortunately, not the most recent release) to be downloaded. After that, there were several attempts to translate and improve the program, but none shared the source again. When I opened the project trying to understand the basic principles, I found that it was incredibly simple and yet sophisticated, acting almost like a virus or anti-virus program.

I just thought it was such a pity that this incredible piece of artwork of C++ programming could be left discontinued, so I decided to “adopt” the project and continue it, even if in the meanwhile I bought a second monitor for my home PC. For the same reason, I published the source code on SourceForge, a proper location for any open source code, and I encourage anyone to join and extend the project. And let me thank again the mysterious coder whose only surviving trail was the term "SFB7." Whoever you are, SFB7 (if this was your nick), thank you.

I have made many improvements to DxWnd since its first release, using sophisticated techniques that I learned from several great teachers on SourceForge, CodeProject, and other sites. Thank you all, open source supporters!

### How does DxWnd work?

There are several different ways to write a fullscreen application, so there are just as many different ways to handle it, hence some annoying configuration to do before your program is all set up. Please bear in mind that DxWnd is still an experimental program, and its configuration is still a little clumsy. This aspect will be improved and simplified over time.

These are the basic principles of DxWnd's behavior:

1. DxWnd DOES NOT alter your software's behavior in any way (either system or applications) while inactive. While DxWnd is not running, everything behaves as if DxWnd has never been run on your machine, or even existed at all.
2. DxWnd DOES alter the behavior of your application when running: it hooks custom code that changes the application's behavior, hopefully in a positive way, but you never know. It's possible that because of hacks to DirectDraw or other system code there might be annoying effects such as frozen screen, unresponsive keyboard, and so on. Be patient and maybe you'll find a good game setting to use without side effects.
3. Unless you need code injection support (this will be explained later), DxWnd affects ALL games in the shown list, regardless of whether a particular entry is highlighted, and even if you started the game normally, outside the DxWnd interface. You can run your game as usual (clicking on desktop icons, shortcuts, etc.), and as long as DxWnd is running, it hooks ANY game that you've added to its game list, regardless of how you ran that game.
4. DxWnd only hooks into ONE SINGLE game at a time, even if it could be possible to start and intercept more than one in parallel. In some cases, the games work together, but you might see unpredictable behavior if you try to control more than one game at a time. Although parallel capability may be added one day, DxWnd currently hooks only one game at a time. Any games that you run while another game is already being hooked will run normally, without hooking.

DxWnd stores the configuration of altered registry keys in dxwnd.reg and everything else in dxwnd.ini. These configuration files are located in the same folder as the executable (dxwnd.exe) and the hooker (dxwnd.dll). No info is written in the registry or anywhere else in the system, and there is no installation procedure. Just copy the files wherever you like, create shortcut entries wherever you like, and easily back up the configuration by copying dxwnd.ini somewhere else. Also, keep in mind that ALL changes are written on disk only when DxWnd exits safely, so your configuration changes will be lost if it crashes.

From release 2.02.22 onward, you can export and import single settings to separate configuration files, allowing you to share working game configurations by sharing these files only.