Archived

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

Valcar

how do I render a DirectX Scene in a Win32 Picture Control

Recommended Posts

Valcar    122
I am trying to create a view port of the DirectX Graphics Scene in Picture Box on a Dialog. I want it to work as if a windowed DirectX program would, but instead of taking up the whole window, it's just located in the Picture Box. I have been looking for examples/tutorials to do this code for the past couple days, and I have not been able to find anything. I've found much information concerning MFC, but every one I talk to, and from what I've seen, it looks like it takes about 20 times the work to do the same thing. Currently what Im doing: is using FindWindow to get the hWnd of the Picture box IDC_VIEWPORT from the Dialog IDD_MAIN_DIALOG. And it always returns 0 (NULL). I have this code, in the Init Function of the MAIN_DIALOG. If anyone can help me, maybe by pointing me to a working tutorial, or example I would be much ablidged. I am currently awaiting a book to arrive which may help with this problem, but it's still a week away. I would also like to appologise if a similar post is already in the forums, I have looked but was unable to find one. Thanks In Advance! Edited by - Valcar on January 20, 2002 2:26:13 AM

Share this post


Link to post
Share on other sites
Anozireth    122
well as far as making it render in the picture box, I believe you just have to specify the picture box''s HWND when you create the D3D device. If you''re having trouble getting that hwnd, I can''t really help ya.

Share this post


Link to post
Share on other sites
Valcar    122
I was told to use the FindWindow function to get the hWnd of the picture control. When I specify it the information, it returns Null.

Share this post


Link to post
Share on other sites
Oluseyi    2116
You can''t use FindWindow to get the hwnd of the picture control.
quote:
From MSDN:
The FindWindow function retrieves a handle to the top-level window whose class name and window name match the specified strings. This function does not search child windows.


Try using EnumChildWindows to find all the child windows of your main window/dialog (such as the picture frame) and then use the HWND passed to EnumChildProc.

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!

Share this post


Link to post
Share on other sites
CrazedGenius    156
(I'm not sure - are you using MFC? If so...)

If it's your app and your picturebox, you should be able to use GetSafeHwnd(). I don't use picture boxes, but this should work...

In general, you do something like this (paraphrased):

OnInitDialog()
{
myStatic.Create(....)
HWND Handle = myStatic.GetSafeHwnd();
...
}

Edited by - CrazedGenius on January 20, 2002 3:14:13 AM

Share this post


Link to post
Share on other sites
Valcar    122
I''m trying to avoid using MFC, from what I hear it makes a lot more work than it''s worth. So no, I''m using a simple Win32 application dialog.

Share this post


Link to post
Share on other sites
CrazedGenius    156
Actually, this kind of window management stuff is one of the few things MFC is good for (in the context of DirectX). The purpose of the library was to make things easier. There''s alot of anti-MFC talk out there, but if you are dealing with different windows, I think it makes alot of sense.

I''m guessing that you want to create a smaller viewport so that you can add other UI components? If so, check out MFCTex.

Share this post


Link to post
Share on other sites