| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1422 人关注过本帖
标题:设定按钮的状态
只看楼主 加入收藏
jkzhp
Rank: 1
等 级:新手上路
帖 子:32
专家分:0
注 册:2004-8-2
收藏
 问题点数:0 回复次数:7 
设定按钮的状态

各位大侠好:

小弟新学C++用来设计窗体,在窗体上有几个按钮,想用代码控制按钮是否可用,这个应当如何下手,请指教,不胜感激!!!!!!!!!!!!!

搜索更多相关主题的帖子: 按钮 状态 窗体 
2004-08-02 21:01
kuangjingbo
Rank: 1
等 级:新手上路
帖 子:312
专家分:0
注 册:2004-4-24
收藏
得分:0 

这些不属于c++问题,而属于windows编程的问题

建议你看看关于windows编程的书籍,比如《windows程序设计》、《windows核心编程》。

也可以自己查看msdn,里面有你想要的

你要的函数是:

BOOL EnableWindow( HWND hWnd, // handle to window BOOL bEnable // flag for enabling or disabling input );

这个函数的具体用法在下面帖出,但是是英语的

------------------------------------------

授人以鱼,不如授人以渔!


永不放弃!
2004-08-03 20:26
kuangjingbo
Rank: 1
等 级:新手上路
帖 子:312
专家分:0
注 册:2004-4-24
收藏
得分:0 
EnableWindow
The EnableWindow function enables or disables mouse and keyboard input to the specified window or control. When input is disabled, the window does not receive input such as mouse clicks and key presses. When input is enabled, the window receives all input.
BOOL EnableWindow(
  HWND hWnd,     // handle to window
  BOOL bEnable   // flag for enabling or disabling input
);
 
Parameters
hWnd
Handle to the window to be enabled or disabled.
bEnable
Specifies whether to enable or disable the window. If this parameter is TRUE, the window is enabled. If the parameter is FALSE, the window is disabled.
Return Values
If the window was previously disabled, the return value is nonzero.
If the window was not previously disabled, the return value is zero. To get extended error information, callGetLastError.
Remarks
If the enabled state of a window is changing, a WM_ENABLE message is sent before the EnableWindow function returns. If a window is already disabled, all its child windows are implicitly disabled, although they are not sent a WM_ENABLE message.
A window must be enabled before it can be activated. For example, if an application is displaying a modeless dialog box and has disabled its main window, the application must enable the main window before destroying the dialog box. Otherwise, another window will receive the keyboard focus and be activated. If a child window is disabled, it is ignored when the system tries to determine which window should receive mouse messages.
By default, a window is enabled when it is created. To create a window that is initially disabled, an application can specify the WS_DISABLED style in the CreateWindow or CreateWindowEx function. After a window has been created, an application can use EnableWindow to enable or disable the window.
An application can use this function to enable or disable a control in a dialog box. A disabled control cannot receive the keyboard focus, nor can a user gain access to it.

[此贴子已经被作者于2004-08-03 20:36:43编辑过]



永不放弃!
2004-08-03 20:28
jkzhp
Rank: 1
等 级:新手上路
帖 子:32
专家分:0
注 册:2004-8-2
收藏
得分:0 
十分感谢你的帮助,我做到了!

大地无限,天外有天,阔大无比——————大天阔
2004-08-05 17:21
kuangjingbo
Rank: 1
等 级:新手上路
帖 子:312
专家分:0
注 册:2004-4-24
收藏
得分:0 

不客气!

还是看看<<windows程序设计>>,应该对你有很大帮助!


永不放弃!
2004-08-05 19:00
C++大粉丝
Rank: 4
等 级:贵宾
威 望:10
帖 子:477
专家分:0
注 册:2004-4-23
收藏
得分:0 
Windows核心编程...

I am a big fan of c plus plus.
2004-08-10 22:09
fastmouse
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2004-8-9
收藏
得分:0 

多看看MSDN,一般你需要的函数都能找到,VC自带的最好资源

2004-08-10 23:12
kuangjingbo
Rank: 1
等 级:新手上路
帖 子:312
专家分:0
注 册:2004-4-24
收藏
得分:0 

多看帮助文档!msdn!


永不放弃!
2004-08-11 09:50
快速回复:设定按钮的状态
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017597 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved