G
Guest
Please excuse this elementary question...but I am just dumb....
I have taken a simplistic Dialog Box and added a Progress Control.
When I did that, my Dialog Box was no longer able to intialize using the
DialogBox macro.
If I remove the Progress Control from the form, the form displays
appropriately.
Is there something that needs to be done in addition to providing a callback
function for the dialog?
Here is a brief outline of the code (which is quite simplistic).
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam)
{
int wmId, wmEvent, rtn_val = 0;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
rtn_val = (int)DialogBox(hInst, (LPCTSTR)IDD_FORMVIEW, hWnd,
(DLGPROC)Formview);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// Message handler for progress bar form.
LRESULT CALLBACK Formview(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
{
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}
The resource (IDD_FORMVIEW) is a simplistic dialog box with a couple of
Static Text fields and a "STOP" Button.
So I am stuck with the following:
1.) How can I get the form to display (i.e. should I ditch the DialogBox
macro?)
2.) How do I dynamically change the progress bar appearance (i.e. how do I
directly call into the form to change the appearance of the bar)?
Any help or shove in the right direction would be appreciated.
I have taken a simplistic Dialog Box and added a Progress Control.
When I did that, my Dialog Box was no longer able to intialize using the
DialogBox macro.
If I remove the Progress Control from the form, the form displays
appropriately.
Is there something that needs to be done in addition to providing a callback
function for the dialog?
Here is a brief outline of the code (which is quite simplistic).
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam)
{
int wmId, wmEvent, rtn_val = 0;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
rtn_val = (int)DialogBox(hInst, (LPCTSTR)IDD_FORMVIEW, hWnd,
(DLGPROC)Formview);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// Message handler for progress bar form.
LRESULT CALLBACK Formview(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
{
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
break;
}
return FALSE;
}
The resource (IDD_FORMVIEW) is a simplistic dialog box with a couple of
Static Text fields and a "STOP" Button.
So I am stuck with the following:
1.) How can I get the form to display (i.e. should I ditch the DialogBox
macro?)
2.) How do I dynamically change the progress bar appearance (i.e. how do I
directly call into the form to change the appearance of the bar)?
Any help or shove in the right direction would be appreciated.