我在ATL中做了个ACTIVEX,并在上面放了些控件但无法对它们进行操作,应该获得这些控件,并对他们进行操作

解决方案 »

  1.   

    用GetDlgItem获得控件句柄操作。
      

  2.   

    在控件类的构造函数中加一条
    m_bWindowOnly = TRUE;再通过CContainedWindow::SubclassWindow子类化控件。
      

  3.   

    如何通过,在那里CContainedWindow::SubclassWindow子类化控件。
      

  4.   

    你建一个CContainedWindow对象,然后调用它的SubclassWindow子类化控件。它封装了基本的窗口操作。从CWindow派生而来。
      

  5.   

    能不能举个例子
    HWND hwnd;
    CSliderCtrl     *m_slider1;
    hwnd = GetDlgItem(IDC_slider1);

    m_slider1=(CSliderCtrl *)hwnd;
    m_slider1->SetRange(0,100);
      

  6.   

    HWND hwnd = GetDlgItem(IDC_slider1);
    if ( IsWindow(hwnd) )
    {
         CContainedWindow ctlObj;
         ctlObj.SubclassWindow( hwnd );
    }
      

  7.   

    warning C4003: not enough actual parameters for macro 'SubclassWindow'
    : error C2059: syntax error : '('
    : error C2039: 'hwnd' : is not a member of 'CContainedWindowT<class ATL::CWindow,class ATL::CWinTraits<1442840576,0> >'
    : error C2039: 'AfxMessageBox' : is not a member of 'CContainedWindowT<class ATL::CWindow,class ATL::CWinTraits<1442840576,0> >'
    : error C2039: 'str' : is not a member of 'CContainedWindowT<class ATL::CWindow,class ATL::CWinTraits<1442840576,0> >'
    : error C2039: 'Format' : is not a member of 'CContainedWindowT<class ATL::CWindow,class ATL::CWinTraits<1442840576,0> >'
    Error executing cl.exe.vcwmp.dll - 5 error(s), 1 warning(s)