none
ActiveX 控件 RRS feed

  • 问题

  • 我用ATL创建了个Active项目, 然后创建了个 控件,放到ActiveX Control Test里面都正常,MESSAGE_HANDLER影射也没问题,可是放到RicheEdit里面

    BEGIN_MSG_MAP(XXXXX)
    MESSAGE_HANDLER(WM_TIMER, OnTimer)
    MESSAGE_HANDLER(WM_CREATE, OnCreate)
    MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLBD)
    MESSAGE_HANDLER(WM_DESTROY, OnClose)
    MESSAGE_HANDLER(WM_ERASEBKGND, OnErase)
    CHAIN_MSG_MAP(CComControl<XXXXX>)
    DEFAULT_REFLECTION_HANDLER()
    END_MSG_MAP()

    (其余的代码为VS自动创建)

    映射的消息完全没反应,如virtual HWND CreateControlWindow(HWND hWndParent, RECT& rcPos)这种函数也没反应,请问这是怎么回事,相关文档去哪里找

    RicheEdit插入代码

       

    ITest *pTest = NULL;
    hr = CoCreateInstance(CLSID_Test, NULL, CLSCTX_INPROC_SERVER, IID_ITest, (void **)&pTest);
    if(hr != S_OK)
    _com_issue_error(hr);

    LPOLEOBJECT lpObject;
    hr = pTest->QueryInterface(IID_IOleObject, (void**)&lpObject);
    if(hr != S_OK)
    _com_issue_error(hr);

    OleSetContainedObject((LPOLEOBJECT)lpObject, TRUE);

    REOBJECT reo;
    memset(&reo, 0, sizeof(reo));
    reo.cbStruct = sizeof(reo);
    reo.cp = REO_CP_SELECTION;
    reo.dvaspect = DVASPECT_CONTENT;
    reo.dwFlags = REO_BELOWBASELINE; 
    reo.poleobj = lpObject;
    reo.polesite = lpOleClientSite;
    reo.pstg = lpStorage;
    reo.clsid = __uuidof(XXXXXX); 
    reo.dwUser = 0;

    SIZEL sizel;  
    sizel.cx = sizel.cy = 0; 
    reo.sizel = sizel;

    hr=pRichEditOle->InsertObject(&reo);

    2012年9月18日 2:47

答案

全部回复