PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Accessing dialog controls when adapting the GDIDemo

I have the following problem:

I am adapting the GDIDemo app and am trying to add different dialog boxes. i.e a simple dialog box with Ok/canel and a CSliderCtrl. I have created an IDM_ reference so I can capture the message when the user clicks on that id in the menu. I capture this in the WndProc no problems then with a call to DialogBox(….) create the dialog passing the appropriate CALLBACK. This all appears to be working fine. In the CALLBACK I can catch the appropriate messages ok i.e. ONOK and ONCANCEL. The problem is when I obtain a pointer to a control such as the CSliderCtrl with (CSliderCtrl*)GetDlgItem(hDlg, IDC_SLIDER) , I can’t do anything with it . It is not returning NULL so I am assuming it has obtained a valid handle on the control but I am not able to do anything useful like set the min and max ranges or capture the thumbs current position. I am assuming I do this in ON_INITIATE, then get the thumbs value in ONOK before destroying the dialog.

Similar things happen with CEditBoxs , I am unale to set or return any strings from them.

I don’t wish to use the class wizard as this just seems to add an extra layer of complexity to something that should be quite simple. I actually have tried using it but had even less success anyway and I don‘t think I should need to use it any way.

Any ideas guys,
Thanks.