Hi.
I have one dialog box window containing a button, which, once the user clicks on it, pops up another dialog box prompting the user for some input.
The code is (something) like this:
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_BUTTONPRESS:
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE (IDD_GETUSERINPUT),hwnd, UserInputDlgProc);
break;
}
.
. <= rest of code here
.
}
The code works from the sense that the 2nd dialog box pops up when the user clicks the button. However, what is the *correct* way to obtain the inputted user value from the 2nd dialog box? The above function needs to get the value from that dialog box and do something with it.
I thought of creating a global variable that can be written to within the 2nd dialog box's function, but this just doesnt seem like good programming practice. And not only that, I am getting strange bugs (race conditions?) in my program that makes me very suspicious about the manner in which I implemented this code.
Any Ideas? Is there something fundamentally wrong with embedding one dialog box within another dialog box?
Any help is greatly appreciated.
Thanks,
--Norm
I have one dialog box window containing a button, which, once the user clicks on it, pops up another dialog box prompting the user for some input.
The code is (something) like this:
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_BUTTONPRESS:
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE (IDD_GETUSERINPUT),hwnd, UserInputDlgProc);
break;
}
.
. <= rest of code here
.
}
The code works from the sense that the 2nd dialog box pops up when the user clicks the button. However, what is the *correct* way to obtain the inputted user value from the 2nd dialog box? The above function needs to get the value from that dialog box and do something with it.
I thought of creating a global variable that can be written to within the 2nd dialog box's function, but this just doesnt seem like good programming practice. And not only that, I am getting strange bugs (race conditions?) in my program that makes me very suspicious about the manner in which I implemented this code.
Any Ideas? Is there something fundamentally wrong with embedding one dialog box within another dialog box?
Any help is greatly appreciated.
Thanks,
--Norm