Direct3D in a Dialog?

Started by
4 comments, last by Dov Sherman 20 years ago
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?
Advertisement
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.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

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.

Too old for this ...
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.
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?

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.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

This topic is closed to new replies.

Advertisement