?
hi,
habs nun selbst rausgefunden, man muss da in der dispatch_map noch was manuell hinzufügen!! was macht eigentlich die dispatch map?
// Dispatch mapge
BEGIN_DISPATCH_MAP(CActiveX_ExampleCtrl, COleControl)
DISP_FUNCTION_ID(CActiveX_ExampleCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
DISP_FUNCTION_ID(CActiveX_ExampleCtrl, "Start", 1, Start, VT_EMPTY, VTS_NONE)
DISP_FUNCTION_ID(CActiveX_ExampleCtrl, "Stop", 2, Stop, VT_EMPTY, VTS_NONE)
END_DISPATCH_MAP()
void CActiveX_ExampleCtrl::Start()
{
SetTimer(1, 200, 0);
}
void CActiveX_ExampleCtrl::Stop()
{
KillTimer(1);
m_Counter = 0;
InvalidateRect(NULL);
}
void CActiveX_ExampleCtrl::OnTimer(UINT_PTR nIDEvent)
{
// TODO: Add your message handler code here and/or call default
COleControl::OnTimer(nIDEvent);
m_Counter++;
InvalidateRect(NULL);
}
void CActiveX_ExampleCtrl::OnDraw(
CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
if (!pdc)
return;
// TODO: Replace the following code with your own drawing code.
//pdc->FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH)));
//pdc->Ellipse(rcBounds);
stringstream str1;
str1 << m_Counter;
pdc->TextOutA(100, 100, str1.str().c_str());
}
und in der .idl datei sind folgende änderungen manuell zu machen bzgl. start u stopp:
dispinterface _DActiveX_Example
{
properties:
methods:
[id(DISPID_ABOUTBOX)] void AboutBox();
[id(1)] void Start();
[id(2)] void Stop();
};
was ich hier nun gemacht habe ist ja ganz normales MFC ActiveX Control...wie baut man in visual studio 2005 eine DCOM Anwendung?
cu