龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

VC编程经验汇总

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
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_N

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);

精彩图集

赞助商链接