CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

SendMessage的返回值是什么?

楼主yangl79(杨)2004-02-02 18:09:26 在 VC/MFC / 基础类 提问

如题。 问题点数:10、回复次数:6Top

1 楼titilima(李马 - www.titilima.cn)回复于 2004-02-02 18:17:38 得分 0

根据具体消息的不同,SendMessage的返回值也是不同的,具体消息及相应的返回值可以查阅MSDN。Top

2 楼lzzqqq(Jonersen)回复于 2004-02-02 18:19:13 得分 0

一个四字节的值,  
  对不同的消息可以解释成不同的意义。  
  比如一个DWORD数值,或某种数据类型的指针。  
  很少有用SendMessage返回值的情况。Top

3 楼zhuyie()回复于 2004-02-02 18:24:45 得分 0

就是响应该消息的处理函数的返回值Top

4 楼yangl79(杨)回复于 2004-02-02 18:25:40 得分 0

我就见过用SendMessage发送BM_GETCHECK给RADIOBUTTON检查是否选中某项。Top

5 楼titilima(李马 - www.titilima.cn)回复于 2004-02-02 20:29:20 得分 10

BM_GETCHECK   Message  
   
  --------------------------------------------------------------------------------  
   
  An   application   sends   a   BM_GETCHECK   message   to   retrieve   the   check   state   of   a   radio   button   or   check   box.    
   
  Syntax  
   
   
  To   send   this   message,   call   the   SendMessage   function   as   follows.    
  lResult   =   SendMessage(             //   returns   LRESULT   in   lResult  
            (HWND)   hWndControl,             //   handle   to   destination   control  
            (UINT)   BM_GETCHECK,             //   message   ID  
            (WPARAM)   wParam,             //   =   0;   not   used,   must   be   zero  
            (LPARAM)   lParam             //   =   0;   not   used,   must   be   zero  
  );        
  Parameters  
   
  wParam  
  Not   used;   must   be   zero.    
  lParam  
  Not   used;   must   be   zero.    
  Return   Value  
   
  The   return   value   from   a   button   created   with   the   BS_AUTOCHECKBOX,   BS_AUTORADIOBUTTON,   BS_AUTO3STATE,   BS_CHECKBOX,   BS_RADIOBUTTON,   or   BS_3STATE   style   can   be   one   of   the   following.  
   
  BST_CHECKED   Button   is   checked.    
  BST_INDETERMINATE   Button   is   grayed,   indicating   an   indeterminate   state   (applies   only   if   the   button   has   the   BS_3STATE   or   BS_AUTO3STATE   style).    
  BST_UNCHECKED   Button   is   cleared    
   
  以上就是MSDN中关于BM_GETCHECK的解释,如你所见,在这里SendMessage的返回值就是这个Radio或CheckBox的选中情况,但是对于LB_GETCOUNT消息而言,它的返回值就是ListBox的列表项总数了:  
  LB_GETCOUNT   Message  
   
  --------------------------------------------------------------------------------  
   
  An   application   sends   an   LB_GETCOUNT   message   to   retrieve   the   number   of   items   in   a   list   box.    
   
  Syntax  
   
   
  To   send   this   message,   call   the   SendMessage   function   as   follows.    
  lResult   =   SendMessage(             //   returns   LRESULT   in   lResult  
            (HWND)   hWndControl,             //   handle   to   destination   control  
            (UINT)   LB_GETCOUNT,             //   message   ID  
            (WPARAM)   wParam,             //   =   (WPARAM)   ()   wParam;  
            (LPARAM)   lParam             //   =   (LPARAM)   ()   lParam;  
  );        
  Parameters  
   
  wParam  
  Not   used;   must   be   zero.    
  lParam  
  Not   used;   must   be   zero.    
  Return   Value  
   
  The   return   value   is   the   number   of   items   in   the   list   box,   or   LB_ERR   if   an   error   occurs.    
   
   
   
  Remarks  
   
  The   returned   count   is   one   greater   than   the   index   value   of   the   last   item   (the   index   is   zero-based).Top

6 楼yangl79(杨)回复于 2004-02-02 21:06:28 得分 0

我的MSDN是两张盘,好多东西里面都没有,当然真该卖三张的。Top

相关问题

  • SendMessage什么时候返回?
  • ====SendMessage如何返回值??=====
  • 返回值是什么?
  • 返回类型LRESULT,返回值1是什么意思,0呢?
  • malloc()的返回值是什么?
  • 为什么maxcount的返回值为-1
  • WaitForSingleObject,WaitForMultipleObjects的返回值是什么?
  • ParameterDirection.ReturnValue到底返回的是什么值?
  • 请问这个返回值是什么?
  • InputBox的返回值是什么?

关键词

  • 消息
  • sendmessage
  • getcheck
  • 返回值
  • bs
  • lresult
  • bm
  • bst
  • getcount
  • wparam

得分解答快速导航

  • 帖主:yangl79
  • titilima

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo