EnderW4785 0 Newbie Poster

I'm probably going about this all wrong, but I've written a piece of code that pops of a window, activates a DirectX device within the window, draws the mesh, paints on a texture and then allows me to move around the mesh with the arrow keys until I close the window at which time everything exits.

Now, the next step that I want to make is to put a control button on that original window that will allow me to call a function that controls which texture is painted onto the mesh. Here is how I've been trying to create the button:

// Register the window class
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
"D3D Tutorial", NULL };
RegisterClassEx( &wc );


// Create the application's window
HWND hWnd = CreateWindow( "D3D Tutorial", "D3D Tutorial 06: Meshes",
WS_OVERLAPPEDWINDOW, 200, 100, 450, 450,
NULL, NULL, wc.hInstance, NULL );


HWND hButton = CreateWindow( "button", "Configure",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON ,
540, 440, 100, 100, hWnd, 0, wc.hInstance, 0);

Then the next bit of code shows the hWnd window and the hButton window, draws the mesh etc.

The problem is the hButton window never shows up. If I remove the WS_CHILD option, it does, but then its no longer a child of the original window and I won't be able to see the message it throws when its clicked.

So, again, I'm probably going about this all wrong, but I'd like to attach a control to the original window. Any help would be greatly appreciated.