VC编程经验汇总
2009-10-07 20:29:14 来源:WEB开发网1. 显示和隐藏标题栏
方法一:使用API实现
//隐藏TitleBar
LONG lStyle = ::GetWindowLong(this->m_hWnd, GWL_STYLE);
::SetWindowLong(this->m_hWnd, GWL_STYLE, lStyle & ~WS_CAPTION);
::SetWindowPos(this->m_hWnd, NULL, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
// 显示TitleBar
::SetWindowLong(this->m_hWnd, GWL_STYLE, lStyle | WS_CAPTION);
::SetWindowPos(this->m_hWnd, NULL, 0, 0, 0, 0,??SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
方法二:使用CWnd成员函数ModifyStyle实现
// 隐藏TitleBar
ModifyStyle(WS_CAPTION, 0, SWP_FRAMECHANGED);
// 显示TitleBar
ModifyStyle(0, WS_CAPTION, SWP_FRAMECHANGED);
2 . 怎么用SendMessage()来发送消息来清空它的内容??
HWND hEditWnd=GetDlgItem(IDC_EDIT1)->GetSafeHwnd();
::SendMessage(hEditWnd,WM_SETTEXT,(WPARAM)0,(LPARAM)"");
3. 弹出文件的属性窗口
SHELLEXECUTEINFO ShExecInfo ={0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST ;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = "properties";
ShExecInfo.lpFile = "c:\"; //也可以是文件
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
更多精彩
赞助商链接