这是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;}

解决方案 »

  1.   

    SendMessage(hWnd, BM_SETCHECK, BST_UNCHECKED, 0);
      

  2.   

    多谢,我有WinAPI的书,应该怎么找到这些有关各控件的消息或其他参数呢?比如你写的BM_SETCHECK, BST_UNCHECKED等应该在哪些章节能找到呢?多谢~~
      

  3.   

    在微软的MSDN里可以查到。
    Platform SDK Documentation -> Windows API -> Overview of the Windows API -> User Interface -> Buttons -> Button Reference -> Button Messages