VC++ Windows窗口处理函数【固定窗口】

本文详细介绍了VC++中CMainFrame类的OnSysCommand函数,用于处理WM_SYSCOMMAND消息。该消息涉及多种系统命令,如窗口关闭、最大化、最小化、移动等。通过对uCmdType参数的解析,可以实现不同操作的响应,例如SC_MOVE、SC_RESTORE等。同时,还列举了WM_SYSCOMMAND消息中其他可能的命令类型及其作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 void   CMainFrame::OnSysCommand(UINT   nID,   LPARAM   lParam)     
  {   
  switch(nID   &   0xFFF0)   
  {   
  case   SC_MOVE:   
  return;   
  case   SC_RESTORE:   
  if(!IsIconic())return;   
                    break;   
  }   
  CFrameWnd::OnSysCommand(nID,   lParam);   
  }



  截取WM_SYSCOMMAND消息。   
  该消息参数为:   
          uCmdType   =   wParam;   //   type   of   system   command   requested     
          xPos   =   LOWORD(lParam);   //   horizontal   postion,   in   screen   coordinates     
          yPos   =   HIWORD(lParam);   //   vertical   postion,   in   screen   coordinates     
          其   中   uCmdType表   示   用   户   的   选   择   :     
          SC_CLOSE   Closes   the   window.     
          SC_CONTEXTHELP   Changes   the   cursor   to   a   question   mark   with   a   pointer.   If   the   user   then   clicks   a   control   in   the   dialog   box,   the   control   receives   a   WM_HELP   message.     
          SC_DEFAULT   Selects   the   default   item;   the   user   double-clicked   the   System   menu.     
          SC_HOTKEY   Activates   the   window   associated   with   the   application-specified   hot   key.   The   low-order   word   of   lParam   identifies   the   window   to   activate.     
          SC_HSCROLL   Scrolls   horizontally.     
          SC_KEYMENU   Retrieves   the   System   menu   as   a   result   of   a   keystroke.     
          SC_MAXIMIZE   (or   SC_ZOOM)   Maximizes   the   window.     
          SC_MINIMIZE   (or   SC_ICON)   Minimizes   the   window.     
          SC_MONITORPOWER   Windows   95   only:   Sets   the   state   of   the   display.   This   command   supports   devices   that   have   power-saving   features,   such   as   a   battery-powered   personal   computer.     
          SC_MOUSEMENU   Retrieves   the   System   menu   as   a   result   of   a   mouse   click.     
          SC_MOVE   Moves   the   window.     
          SC_NEXTWINDOW   Moves   to   the   next   window.     
          SC_PREVWINDOW   Moves   to   the   previous   window.     
          SC_RESTORE   Restores   the   window   to   its   normal   position   and   size.     
          SC_SCREENSAVE   Executes   the   screen   saver   application   specified   in   the   [boot]   section   of   the   SYSTEM.INI   file.     
          SC_SIZE   Sizes   the   window.     
          SC_TASKLIST   Executes   or   activates   Windows   Task   Manager.     
          SC_VSCROLL   Scrolls   vertically.    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值