I would like to create few extra windows in my NES emulator. I have tried many times but I do not know how to do it. I would like extra windows for debugging information and such.
Here is an example of what I mean; (the image at the bottom of the page)
http://home.pacbell.net/michal_k/6502.html
Assuming Win32 C/C++ (since you didn't specify)
Creating a window consists of two steps:
- Registering the window class (look up WNDCLASSEX and RegisterClassEx() on MSDN or something)
- Creating the window (look up CreateWindowEx() )
You must assign your window a "class name" which is a short string that you'll have to give to both your WNDCLASSEX structure and your call to CreateWindowEx(). The class name is what binds the properties of the WNDCLASSEX struct to the window created by CreateWindowEx().
You can repeat the process for multiple windows, assigning them each a different classname (or even having them share, if for example, you want two Hex Editor/Memory viewer windows, you can register a single WNDCLASSEX, then Create two windows with the same class name).
I've heard the style of windows in that screenshot you linked referred to as 'MDI' before. I don't have much experience with those types of windows myself, however I don't think they're that hard to make.
You'd just need to make a single parent window (which is more or less empty -- just a container for the other windows). Then you create other windows with the WS_CHILD style specified, and giving the HWND to the parent window as this new window's parent. That will make the child window be drawn inside of the parent's client area.
Though like I said... I haven't really worked with those types of windows much, so I might be wrong. But try it out and mess around.
Thanks for that. Now I'm interested in having child windows that appear outside of the parent window (i.e. overlaps the edge, not go under it), but don't appear on the taskbar. Can anyone help me with this? I'm using CreateMDIWindow to create the child windows. I know that it is possible to do because the 6502 Simulator in my first post does it. When I checked the source code, it seems to use some kind of CWnd class.
(I'm using C++ btw)
You don't want CreateMDIWindow if you want the "child window" to appear on its own on the desktop - you want CreateWindow with the appropriate flags (parent window, frame type, whether or not it's on the taskbar, etc.).
If you want to see how it's done in C, take a look at Nintendulator's source code - this is exactly what I do for the debugger windows.
One of the windows will be the actual screen itself with blitting and locking and so forth, your extra windows seem to be dialog boxes. Is it still possible?
The windows created are made as modeless dialogs, though I'm pretty sure they could just as easily be created using CreateWindow().
Your modeless dialog box thingy works perfectly, thanks!
Not that I've got my windows, I'm interested in text windows that would display 6502 code and such. Do I need to use a dialog box's list box to do this or is there some other way?