dialog proc的返回值(TRUE),会引发界面显示出错
来源:互联网 发布:l360清零软件下载 编辑:程序博客网 时间:2024/06/06 21:37
当调用DialogBoxParam()的时候,窗口就是没法正确显示.窗口处理函数中的GetLastError()没提示出错,但Show()函数里的GetLastError()提示错误号为87(参数不正确),实在搞不明白了,我的参数都没问题的啊! 谢谢
int CMpsdProperties::Show()
{
int result = 0;
//Do the dialog box
result = (int)DialogBoxParam(GetInstance(),
MAKEINTRESOURCE(IDD_PROPERTIES_PARENT),NULL, (DLGPROC) ParentDlgProc,(LONG) this);
DWORD err = GetLastError();
return 1;
}
//窗口处理函数
BOOL CALLBACK CMpsdProperties::ParentDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
CMpsdProperties * _this = (CMpsdProperties *) GetWindowLong(hWnd, GWL_USERDATA);
RECT rc;
int nScreenWidth,nScreenHeight;
int wndWidth,wndHeight;
DWORD err;
switch (message)
{
case WM_INITDIALOG:
// Retrieve the Dialog box parameter and use it as a pointer to the calling vncProperties object
SetWindowLong(hWnd, GWL_USERDATA, lParam);
_this = (CMpsdProperties *) lParam;
// Set the dialog box 's title to indicate which Properties we 're editting
SetWindowText(hWnd, "播放器: 播放参数 ");
nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
GetWindowRect(hWnd,&rc);
wndWidth = rc.right - rc.left;
wndHeight = rc.bottom - rc.top;
rc.left = (nScreenWidth - (rc.right - rc.left))/2;
rc.top = (nScreenHeight - (rc.bottom - rc.top))/2;
bRes = MoveWindow(hWnd,rc.left,rc.top, wndWidth,wndHeight,FALSE);
ShowWindow(hWnd,SWP_SHOWWINDOW);
err = GetLastError();
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
case IDC_APPLY:
case IDCANCEL:
EndDialog(hWnd, IDCANCEL);
break;
}
break;
case WM_CLOSE:
case WM_DESTROY:
EndDialog(hWnd,IDCANCEL);
break;
default:
DefWindowProc(hWnd, message, wParam, lParam);
break;
}
return TRUE;
}
BOOL CALLBACK CMpsdProperties::ParentDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
这个函数应该
return false;
DialogProc函数返回值msdn解释:
Typically, the dialog box procedure should return TRUE if it processed the message, and FALSE if it did not. If the dialog box procedure returns FALSE, the dialog manager performs the default dialog operation in response to the message.
所以,没有处理的消息都应该 return false;
源自:
http://topic.csdn.net/u/20070917/15/19780094-1c3d-486f-9d9a-91063e45e1a0.html?1695638788
- dialog proc的返回值(TRUE),会引发界面显示出错
- 浅析Dialog不显示,isShowing()却返回true
- 函数出错会返回值
- Dialog显示引发异常
- Dialog的isShowing()方法一直返回为true
- js中 [] ? true : false 的返回值为什么是true?
- ListView设置OnTouchListener返回true会怎样
- window.showModalDialog方法返回值为对象,若Dialog窗口中返回的对象为数组,会丢失数组构造信息,不能对返回值使用Array方法。
- 进入界面显示Dialog或者PopupWindow闪退的处理
- 由@DynamicInsert(true) @DynamicUpdate(true)引发的“血案”
- Android shrinkResources true 引发的血案
- while(true)引发的Dubbo应用假死
- Android shrinkResources true 引发的血案
- onTouch返回true的含义
- Linux内核:写proc文件的返回值问题
- setOnTouchEvent 设置返回值为true 和 false的区别
- setOnTouchEvent 设置返回值为true 和 false的区别
- setOnTouchEvent 设置返回值为true 和 false的区别
- Tkprof
- [转]通过覆盖__atexit进行缓冲区溢出攻击的补充
- C程序中的内存管理
- vb.net对excel的操作------感谢:就爱小毛虫
- 关于edian大小端模式
- dialog proc的返回值(TRUE),会引发界面显示出错
- C语言高级测试(一)
- C语言高级测试(二)---答案
- 深入浅出VA函数的使用技巧
- 一篇好文,以在迷茫时阅读
- 关于Debug和Release之本质区别
- Clean RTF files to any encoding text file type
- 建立博客,方便学习
- A Quick Update About MS08-067 Exploit