during the window's initialization, use the control's Create function, in which you specify the parent HWND, RECT containing the location and height, and the control's ID, among other things. The instance object of the control must NOT be local to a function, but global in the c++ class or program file in which it is used because it must stay in scope during the lifetime of the window.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
well, if the number of controls is small, using global variables is okay. but i prefer to create them locally inside the create function and then use GetDialogItem API to get the handles of the controls when i need them. this eliminates the need of global window handles and makes the program less messy.
the best site regarding the apis is the msdn site itself.
Individual Controls
dialogs
The list of values can be obtained in CreateWindow
as for specyfing the design of the window like a dialog box, i have found a way to do that yet using a resource editor.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
.is there any way of specifying the design of the window in the resource file in the way you can design your dialog box and menus etc ?
use CFormView instead of CView and the view will look and act like a dialog box -- and you can design it like one too.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
as for specyfing the design of the window like a dialog box, i have found a way to do that yet using a resource editor.
I meant i have NOT found a way to do that yet. at least not in pure win32.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
CView and CFormView are MFC c++ classes. But you need to use VC++ 6.0 or newer to use them. Call the win32 api function EnableWindow() to enable and disable buttons and most other windows too.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
very simple -- if you have the HWND of the button
// m_hWnd is the handle of the dialog
HWND hWhd = GetdlgItem(m_hWnd,IDC_BUTTON1);
EnableWindow(hWnd,FALSE);
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343