Jump to content
  • Advertisement
Sign in to follow this  
nosajghoul

MFC stressing me out, heres example

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

whats wrong w the following code :
	CSliderCtrl *csc = 0;
	csc = new CSliderCtrl;
	csc->SetRange(0, 100, TRUE);
	csc->SetTicFreq(2);
	CWnd *pWndHandle = 0;
	pWndHandle = new CWnd;
	
	csc->Create(WS_CHILD | WS_VISIBLE | SS_CENTER, CRect(50,80,150,150), pWndHandle->GetParent() , 7);

All Im trying to do is make a slider control, but understand it in code. I think the problem is that I dont know how to get the hWnd of a parent window, or retrieve the hWnd of a child window.

Share this post


Link to post
Share on other sites
Advertisement
1) You can't call methods on the slider until you have called Create to make the window for it. Usually you create the slider as a child of a dialog (in OnInitDialog) or as a child of a view (in OnInitialUpdate).
2) You construct a CWnd with new which it looks like you want to be the parent of the slider, but you don't call Create on that either. Normally you would parent it with the CDialog derived class or the CView derived class in the functions mentioned above, using just the "this" pointer as the parent HWND.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!