Sign in to follow this  

DX in a window thats in a window

This topic is 4869 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 again, another odd request that google isnt being forthcoming with..... I realized that since everything is a window (a button, a picture, a checkbox, etc.... all windows, right?), then if all windows have a HWND, and all directX needs in order to draw something is a handle (a HWND) to something, you *should* be able to draw a (for example) rotating cube on a button, or draw the scene in a picture and have controlls outside it. So my question is : how do you make a picture area? btw, I dont know MFC, or really any code for any controlls... still googling tho... -Jason

Share this post


Link to post
Share on other sites
Quote:
Original post by Emmanuel Deloget
Needless to say but it is even easier in plain Win32 API since you just have to call GetDlgItem() - this will return either a valid HWND or NULL.

Yup. Win32 isn't much harder than MFC. A bit cleaner though.

Share this post


Link to post
Share on other sites
Quote:
Original post by Pipo DeClown
Yup. Win32 isn't much harder than MFC. A bit cleaner though.


The API isn't harder, but using MFC more than halves the time you spend coding, usually. Atleast once you get to know MFC, and get used to working with it.

Share this post


Link to post
Share on other sites
MFC is an encapsulation of the Win32 API, therefore imo making it much easier to use. I use MFC all the time in work for our apps, although for game dev, I do tend to go the Win32 API way and use STL. Note that you can still directly call win32 api calls from MFC apps, there is nothing wrong with doing this, it is good practice though to put the scope operator before any of the win32 api calls, example :

::GetDlgItem(IDC_EDITBOX);

::SendMessage(hWnd, WM_CLOSE, 0, 0);

Using memory variables and data exchange in mfc to point to controls is much cleaner than GetDlgItem imo, thus you could just do :

m_EditBox.SetWindowText(_T("Hello"));

instead of :

GetDlgItem(IDC_EDITBOX)->SetWindowText(_T("Hello"));

It also saves having to cast in many situations.

Putting a rotating cube on a button control would require you do to a custom owner drawn button.

Share this post


Link to post
Share on other sites

This topic is 4869 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