
Property sheet data validation
I'm trying to validate the input data in a property sheet when the
user clicks OK. I'd like to keep the property sheet open if the data
is invalid. I can not get the property sheet to stay open. I've
tried SetWindowLong and it appears to be failing (return value is
zero). I've exhausted all my resources and have spent many hours
trying to get this to work. Please help, my boss is going to kill me.
The following is my code. CPage1 is my property page.
BOOL CPage1::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
HWND hwndDlg;
HWND hWnd;
NMHDR* nmhdr = (NMHDR*)lParam;
switch(nmhdr->code){
case PSN_KILLACTIVE:
hwndDlg = GetSafeHwnd();
hWnd = (HWND)::GetParent(hwndDlg);
long temp1;
SetLastError(0); //resets error for SetWindowLong
return value
temp1 =
SetWindowLong(hwndDlg,DWL_MSGRESULT,PSNRET_INVALID_NOCHANGEPAGE);
//I also tried all of the following and none work.
//SetWindowLong(hwndDlg,DWL_MSGRESULT,PSNRET_INVALID);
//SetWindowLong(hwndDlg,DWL_MSGRESULT,true);
//SetWindowLong(hWnd,DWL_MSGRESULT,PSNRET_INVALID_NOCHANGEPAGE);
//SetWindowLong(hWnd,DWL_MSGRESULT,PSNRET_INVALID);
//SetWindowLong(hWnd,DWL_MSGRESULT,true);
} return true;
Quote:
}