views:

174

answers:

2

I'm working on a directx application and was wondering how I could add a regular window to the application, one which has text boxes, command buttons and all.

A: 

As far as I know you would have to create a parent window to hold both the "window" that DirectX image is rendered to and the regular window with controls.

frgtn
+2  A: 

For a window to exist it will require a windows forms message pump :

A Win32 message pump typically looks something this and was the heart of win32 programming.

MSG msg;
while(GetMessage(&msg, hwnd, 0, 0))
{
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    // do stuff
}

Today, the C# language tends to abstract the message pump away but you can still get to it.

    protected override void WndProc(ref Message m)
    {
        base.WndProc(ref m);

  // do stuff

    }

You need a call to application.run to launch a windows forms with active message pump. see :

http://msdn.microsoft.com/en-us/library/ms157900.aspx

Hey Ed: This is something you might be looking for :

http://www.directxtutorial.com/Tutorial9/A-Win32/dx9A3.aspx . It talks about creating a window from directx

Signcodeindie