   Creating window controls above windowed DirectX application
  Hi,I have a windowed Direct3D 9 application.  I need to be able to create a window control, such as a button, on the Direct3D window.Thing is, I create the window as usual with the HWND of the Direct3D window, and the control flashes for a single frame then disappears.  By always invalidating the control I can force it to refresh, but I feel this is a poor solution, and it still flickers anyway.Is it possible to display controls in DirectX applications?   
  Heya,I would recommend you rather do any of the following:a) Check the DXSDK out. There have a sample user interface there for common UI components. Checkout the "customui.exe" sample to see what it can do and how to use it.b) Use a 3rd party GUI system like Crazy Eddie's GUI( google it ) for your user interface. c) Roll your own GUI system. Using this you would either need to use transformed vertices or ortho projection. I wouldn't advise you at all to mix Win32 controls or GDI stuff with a window using Direct3D.- Pure   ;  Sorry Pure, I'm not trying to make a custom DirectX drawn GUI.  It's hard to explain the cicumstances, but I need to be able to have standard Win32 controls over the Direct3D window.  It's for some development software I'm making.I have discovered if you make D3D's window a child window to the main window, and specify WS_CLIPSIBLINGS, you can get a button to display, but you have to bring it to front after every frame or it disappears (does DirectX draw on top of it?).One button seems to work but several start glitching, and the application doesn't refresh properly for the first few seconds, and so on.Surely someone's attempted this before?  Any advice from anyone?   ;  DirectX pays no attention to which child windows are on top of it's rendering surface.The ideal option from a programmers perspective is to create two children on your main window, asking D3D to draw to one, and keeping all your win 32 control in another pane beside it.  Like this.If you really need the button over the D3D window, I'd suggest faking it, drawing the control with a textured quad.If you really need Win32 controls, perhaps making a second top level window with no border, containing just the control, might work.  This seems hackish, but it may be the only way to get what you want.Another odd solution could be use swapeffect copy, and present multiple rectangles, avoiding the parts where your controls are.   ;  You can also set DirectX to render in a Panel (in VS2005, don't know the name of the component in MSVC++) by passing the handle of the panel in the initialization of the graphic device. And then you can put your controls near the panel.;Quote:Original post by NamethatnobodyelsetookDirectX pays no attention to which child windows are on top of it's rendering surface....That's odd.  I was able to create a button in the middle of my D3D windowed app and Present is clipping during the copy operation just fine.I created my app's window with the WS_CLIPCHILDREN style and specified a swapeffect of COPY when creating the D3D device.  The button control is created as a child of my app's window. The Present call sets all parameters to NULL.;  AshleysBrain,If you don't need your d3d9 app to run at full speed, just move the render code to be handled during the WM_PAINT message.  Then in your paint message, render the d3d9 code first, then have all your widgets update ('UpdateWindow').  Or if you want it to run at full speed, you could always update your widgets after the render loop.  The latter might not look as good as the first I'm afraid.-brad   ;  The right thing to do is to use COPY for your present mode, and to clip children in the D3D window, just like don said.You may also want to look at the function SetDialogBoxMode() (which has nothing to do with presenting child controls, but is generally useful when mixing D3D and GDI )   ;  Did you look at the DXUT classes for creating controls on a DX window?  Many of the SDK samples use them.  They suppport buttons and combo boxes.CDXUTDialogResourceManagerCD3DSettingsDlgCDXUTDialogAnd you add a callback function OnGUIEvent.They also have a nifty function for display text with sprites.You could just find those classes in the DXUT files and copy them into new .h and .cpp files.;Quote:Original post by donThat's odd.  I was able to create a button in the middle of my D3D windowed app and Present is clipping during the copy operation just fine.I could swear I read otherwise, though perhaps they didn't use the correct flags, or it referred to an older version of DX, possibly even DDraw.  I think the logic was that DX doesn't really mix with the GDI, and the card just places DX content where the window is located, but it's not really mixed in with the GDI.  Cards were designed to clip properly to other windows, because they'd be useless otherwise, but not to children.Wherever I got that impression, and whether or not it was ever valid, I have no idea.  Anyway, great to know 3D cards behave well.