Sign in to follow this  

Direct3D child window within a GDI main window

This topic is 4726 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I would like to embed a Direct3D child window a standard GDI parent window (containing other child windows/common controls) in my UI editor application. Is it going to require a funky initialization and setup process? Any guidance would be much appreciated :) edit: Oh yeah, and I'm using pure win32 API -- no MFC for me...

Share this post


Link to post
Share on other sites
Hi there, yes it can be done, make the second window a child of the first window -in the create window function one of the parameters is for the parent window. It can get tricky though, for some reason windows seems to want duplicate (any buttons etc), which you put in the first window, into the second window. A way around this might be to write a second WINCLASS for the the second window?

BTW, Some people use wxwindows, or visual basic for doing a windows gui, the reason for this is it can become quite hard doing it by hand, you can end up with masses of code like a "createwindow" for every single button etc. hy not try using the new d3dx gui? or like me try making your own one with sprites, and rectangle/mouseclick checking?
The only possibly really difficult thing of doing your own gui, is when you may want to do text input, I am considering doing this with buffered directinput & strings/chararrays and d3dx text.

Tip; if you do it this way, think carefully about it and only implement what you really need- or want, no point trying to implement your own whole "windows gui", also you can make a class for the sprites & rectangle checking, then somesort of simple message checking, like was a button pressed?.

wish you luck & Happy new year.

Share this post


Link to post
Share on other sites
Thanks for the reply Stevieboy.

Actually, I'm merely trying to create a win32 GUI tool (using VC++) to layout my own UI elements for a certain project. So the tool itself is going to have a standard main window that uses win32 common controls to select, edit and manage the layout of my own UI widgets and a D3D child window to display the result.

Is the init process just going to be something like this? ---

1. hMainWindow = CreateWindowEx(...) // Create my custom main window
2. hChildWindow = CreateWindowEx(... , hMainWindow, ...) // Create my custom child window
3. Get the IDirect3D9 object
4. CreateDevice(..., hChildWindow, ...) // Create D3D device with the child window handle

Would I have to worry about the implications of embedding a Direct3D draw buffer within a GDI hdc?

[Edited by - barfy on January 2, 2005 2:35:58 AM]

Share this post


Link to post
Share on other sites

This topic is 4726 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this