Dialog1里面有个按钮button IDC_BUT_DATADDEX2;我想在Dialog2中判断是否灰化,加个头文件可以吗?if(GetDlgItem(IDC_BUT_DATADDEX2)->IsWindowEnabled() == TRUE)
解决方案 »
- GetCursorPos和OnLButtonDown(UINT nFlags, CPoint point)中的点坐标
- 句柄数狂增加!急急!狂谢!
- 发个自己做的东东,顺便散分。。
- 有无简便方法修改服务器发给客户端的http内容
- 关于用程序模拟IE浏览器获得网页数据的小问题,在线等.
- 请教大虾:在使用CTreeCtrl时能不能让每一个节点(Item)包含一个自定义的附属信息,比如对象指针或字符串,然后在获得用户点击的节点时,
- 给一块儿win2000关机的代码,给分!
- 请教
- 谁帮我搞一个VC编的抽奖程序啊?多少分都行啊!!
- vc修改exe
- 如何获得另一个对话框的按钮状态
- 求助 关于数组&指针&地址 等stuff 详见代码
是同一个工程下的么?GetDlgItem(IDC_BUT_DATADDEX2)这个函数必须得指明是哪个hwnd才能取出相应的button.
1>e:\documents and settings\qcc\qcc\insertdialog.h(100) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\documents and settings\qcc\qcc\insertdialog.h(100) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\documents and settings\qcc\qcc\insertdialog.cpp(614) : warning C4129: “s”: 不可识别的字符转义序列
1>QCC.cpp
1>e:\documents and settings\qcc\qcc\insertdialog.h(100) : error C2146: 语法错误 : 缺少“;”(在标识符“qcc”的前面)
1>e:\documents and settings\qcc\qcc\insertdialog.h(100) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\documents and settings\qcc\qcc\insertdialog.h(100) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>QCCDlg.cpp
1>e:\documents and settings\qcc\qcc\insertdialog.h(100) : error C2146: 语法错误 : 缺少“;”(在标识符“qcc”的前面)
1>e:\documents and settings\qcc\qcc\insertdialog.h(100) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\documents and settings\qcc\qcc\insertdialog.h(100) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>SelectDialog.cpp
1>e:\documents and settings\qcc\qcc\insertdialog.h(100) : error C2146: 语法错误 : 缺少“;”(在标识符“qcc”的前面)
1>e:\documents and settings\qcc\qcc\insertdialog.h(100) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>e:\documents and settings\qcc\qcc\insertdialog.h(100) : error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
HWND hwndParent, // 父窗口的句柄
HWND hwndChildAfter, // 得到的子窗口的句柄
LPCTSTR lpszClass, // 子窗口类名
LPCTSTR lpszWindow // 子窗口标题
);
上面的这个函数可以通过父窗口的句柄取得子窗口的句柄,后面的两个参数可以选用其中之一另一个设置成NULL即可!
如果父窗口的句柄不知则可用下面的函数来找到相应的父窗口的句柄:
HWND FindWindow(
LPCTSTR lpClassName, // 主窗口的类名
LPCTSTR lpWindowName // 窗口标题
);
得到句柄后就可以调用GetDlgItem函数了
Dialog2中声明Dialog1的声明对象不行的呀
GetDlgItem
The GetDlgItem function retrieves the handle of a control in the specified dialog box. HWND GetDlgItem(
HWND hDlg, // handle of dialog box
int nIDDlgItem // identifier of control
);
2、然后把Hwnd作为第一个参数,按钮ID作为第二个参数,就得到按钮的Hwnd
3、FromHandle函数获得按钮的CWnd指针
4、IsWindowEnabled
2、应该这样:在两个dlg中相互保留对方的指针,这样就可以访问了。
如: 在dlg1中访问dlg2中控件可以这样:pDlg2->GetDlgItem(IDC_BUT_DATADDEX2)。
1> e:\documents and settings\qcc\qcc\qccdlg.h(22) : 参见“CQCCDlg”的声明
1> 是要改用“.”吗?
1>e:\documents and settings\qcc\qcc\insertdialog.cpp(489) : error C2232: “->CWnd::GetDlgItem”: 左操作数有“class”类型,使用“.”
1>e:\documents and settings\qcc\qcc\insertdialog.cpp(489) : error C2227: “->IsWindowEnabled”的左边必须指向类/结构/联合/泛型类型
if ((qcc->GetDlgItem(IDC_BUT_DATADDEX2)->IsWindowEnabled()) == TRUE)
也就是你只要得到控件的窗口句柄,再用fromhandle构造一个CWnd就可以用这个函数了.