Archived

This topic is now archived and is closed to further replies.

Dov Sherman

Direct3D in a Dialog?

Recommended Posts

Dov Sherman    122
Using VC++ with MFC, I can build a DirectX8 3D windowed application with an SDI or MDI interface but I''m having trouble getting Direct3D to display inside a dialog. Can anyone point me to a good tutorial on the subject?

Share this post


Link to post
Share on other sites
Jerry Velders    122
quote:
Original post by Endurion
All you need to do is get the HWND of the wanted control (best let it be ownerdraw static, SS_OWNERDRAW) and give that to the presentation parameters.



You can get the HWND by using GetDlgItem. You should be able to use any static control for this .. a label control ought to work fine.

Share this post


Link to post
Share on other sites
Kafeen    122
Use the app wizard and set it to create an MFC dialog instead of Single Document Window in the Project Settings.

If you don''t actually want to use the wizard you can atleast have a look to see how it works.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
quote:
Original post by Jerry Velders
quote:
Original post by Endurion
All you need to do is get the HWND of the wanted control (best let it be ownerdraw static, SS_OWNERDRAW) and give that to the presentation parameters.



You can get the HWND by using GetDlgItem. You should be able to use any static control for this .. a label control ought to work fine.


Ah! So I just design the dialog with a static item and then use the HWND of that item for the presentation parameters? I don''t need to create a new item and SubClass it to the original static item?

Share this post


Link to post
Share on other sites
superpig    1825
quote:
Original post by Anonymous Poster
Ah! So I just design the dialog with a static item and then use the HWND of that item for the presentation parameters? I don''t need to create a new item and SubClass it to the original static item?


Nope, no subclassing, you just ''steal'' the control''s screen space. If you need special behaviour from it - for example, if you want it to process its own mouse clicks - then you''ll need to subclass it (to handle WM_LBUTTONDOWN/UP messages the way you want), but that doesn''t happen very often as you can usually just use things like DirectInput to get your data directly.

Share this post


Link to post
Share on other sites