这是C++Builder与windows API的混合编程,希望高人多指点~~~void __fastcall TForm1::Button1Click(TObject *Sender)
{
HWND hWnd
Form2->Show();
if(hWnd=FindWindow(NULL,"Form2"))
{
//ShowMessage("OK");
EnumChildWindows(hWnd,(WNDENUMPROC)EnumChildProc,(LPARAM)(LPCTSTR)"1");
}
}//---------------------------------------------------------------------------
BOOL CALLBACK EnumChildProc(HWND hWnd,LPARAM lParam)
{
static char cClassName[51];
static char cTitle[51];
static const int iBufSize=50; GetClassName(hWnd,cClassName,iBufSize); if(stricmp(cClassName,"TEdit")==0)
SetWindowText(hWnd,(LPCTSTR)lParam);
if(stricmp(cClassName,"TCheckBox")==0)
{
GetWindowText(hWnd,cTitle,iBufSize);
if(cTitle=="cb1")//下面我想实现的功能是:如果是TCheckBox类型的标题文本是"cb1"的CheckBox,
//就去掉复选框的勾选,请问应该怎么实现?
}
return true;}
{
HWND hWnd
Form2->Show();
if(hWnd=FindWindow(NULL,"Form2"))
{
//ShowMessage("OK");
EnumChildWindows(hWnd,(WNDENUMPROC)EnumChildProc,(LPARAM)(LPCTSTR)"1");
}
}//---------------------------------------------------------------------------
BOOL CALLBACK EnumChildProc(HWND hWnd,LPARAM lParam)
{
static char cClassName[51];
static char cTitle[51];
static const int iBufSize=50; GetClassName(hWnd,cClassName,iBufSize); if(stricmp(cClassName,"TEdit")==0)
SetWindowText(hWnd,(LPCTSTR)lParam);
if(stricmp(cClassName,"TCheckBox")==0)
{
GetWindowText(hWnd,cTitle,iBufSize);
if(cTitle=="cb1")//下面我想实现的功能是:如果是TCheckBox类型的标题文本是"cb1"的CheckBox,
//就去掉复选框的勾选,请问应该怎么实现?
}
return true;}
解决方案 »
- 实现:进入主程序界面之前,先显示一个qq魔法表情?
- 动态创建dbf数据库,字符型是ftstring,那数值型的名字是什么啊,长度怎么确定,小数位数怎么确定?请高手指点,谢谢!
- 请问TStringList最多能容纳多少数据?
- 字问题!!如何使"pppp1111"变为"1111qqqq",实现文字反射。。。。
- 如何把Grid的数据存成html,然后用程序读出来?
- delphi的程序文件如何自动保存?比如我每次调试运行时就保存
- 事件和窗体引用
- 合计的问题
- 自己做的Exception OOP基础问题!
- 求救:nvarchar(或varchar)字段的值中含有n个换行,如何在取一批记录(含多个字段)时将换行去掉并返回?真的急!急急!急急!急!!
- 请进来看看,你决不后悔的!!
- 50分寻求InputBox()函数的用法.要求"ok","cancel"按钮能变成"确定","取消".
Platform SDK Documentation -> Windows API -> Overview of the Windows API -> User Interface -> Buttons -> Button Reference -> Button Messages