comctl32: Propsheet exception fix.

Do not attempt to draw a page during WM_PAINT if there is no active page.
This commit is contained in:
Aric Stewart 2007-04-03 12:58:19 -05:00 committed by Alexandre Julliard
parent e3d3d1823d
commit 5688ffb7ab
2 changed files with 36 additions and 0 deletions

View File

@ -3229,6 +3229,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam)
WCHAR szBuffer[256];
int nLength;
if (psInfo->active_page < 0) return 1;
hdc = hdcParam ? hdcParam : BeginPaint(hwnd, &ps);
if (!hdc) return 1;

View File

@ -98,7 +98,42 @@ static void test_title(void)
DestroyWindow(hdlg);
}
static void test_nopage(void)
{
HPROPSHEETPAGE hpsp[1];
PROPSHEETPAGEA psp;
PROPSHEETHEADERA psh;
HWND hdlg;
memset(&psp, 0, sizeof(psp));
psp.dwSize = sizeof(psp);
psp.dwFlags = 0;
psp.hInstance = GetModuleHandleW(NULL);
U(psp).pszTemplate = "prop_page1";
U2(psp).pszIcon = NULL;
psp.pfnDlgProc = page_dlg_proc;
psp.lParam = 0;
hpsp[0] = CreatePropertySheetPageA(&psp);
memset(&psh, 0, sizeof(psh));
psh.dwSize = sizeof(psh);
psh.dwFlags = PSH_MODELESS | PSH_USECALLBACK;
psh.pszCaption = "test caption";
psh.nPages = 1;
psh.hwndParent = GetDesktopWindow();
U3(psh).phpage = hpsp;
psh.pfnCallback = sheet_callback;
hdlg = (HWND)PropertySheetA(&psh);
ShowWindow(hdlg,SW_NORMAL);
SendMessage(hdlg, PSM_REMOVEPAGE, 0, 0);
RedrawWindow(hdlg,NULL,NULL,RDW_UPDATENOW|RDW_ERASENOW);
DestroyWindow(hdlg);
}
START_TEST(propsheet)
{
test_title();
test_nopage();
}