Click here to Skip to main content
15,922,145 members
Home / Discussions / COM
   

COM

 
QuestionHow to make my ActiveX control produced by ATL show its property pages in VB environment? Pin
8-Sep-01 6:00
suss8-Sep-01 6:00 
GeneralConnection Points Pin
Jafer Ali7-Sep-01 18:22
Jafer Ali7-Sep-01 18:22 
I have a COM dll with connction point interfaces. I require to sink the events in the Document class of an MFC SDI appilcation.I change the following in the document
in DeskDoc.h the following changes were made

class CDeskDoc : public COleDocument, public IDispEventImpl<
0,
CDeskDoc,
&DIID__IToolsEvents,
&LIBID_STOOLSLib,
1,
0>
{



public:
CDeskDoc();
HRESULT PassArg(BSTR * pArg);
BEGIN_SINK_MAP(CDeskDoc)
SINK_ENTRY_EX(0, DIID__IToolsEvents, 1, PassArg)
END_SINK_MAP()

}

The DeskDoc.cpp had the following added

HRESULT CDeskDoc::PassArg(BSTR * pArg)
{
BSTR chk;
chk = L"Test";
pArg = &chk;
return S_OK;
}

The following code in the MainFrame invokes the event

void CMainFrame::OnEventTest()
{

CoInitialize(NULL);
//ISDConnectionPoint *pSDConnectionPoint = NULL;
IUnknown *pSDConnectionPoint = NULL;
ITool *pTool = NULL;
HRESULT hr = CoCreateInstance(CLSID_Tool,NULL,CLSCTX_ALL,IID_IUnknown,(void**)&pSDConnectionPoint);
IConnectionPointContainer* pConnectionPointContainer;
hr = pSDConnectionPoint->QueryInterface(IID_IConnectionPointContainer, (void**)&pConnectionPointContainer);
if(SUCCEEDED(hr))
{
IConnectionPoint* pConnectionPoint;
hr = pConnectionPointContainer->FindConnectionPoint(DIID__IToolsEvents, &pConnectionPoint);
// CEventHandler* pSinkEvents = new CEventHandler();
//Get the document pointer
CDeskDoc *pDoc = (CDeskDoc*)GetActiveDocument();
GUID iid ;
BOOL bRet = pDoc->GetDispatchIID(&iid);
LPUNKNOWN lpUnknown = (LPUNKNOWN)pDoc->GetInterface(&IID_IUnknown);
DWORD dwCookie;
pConnectionPoint->Advise( lpUnknown, &dwCookie);
hr = pSDConnectionPoint->QueryInterface(IID_ISharpTool, (void**)&pTool);
pTool->Check(); //This invokes the event PassArg()
pConnectionPoint->Unadvise(dwCookie);
pConnectionPoint->Release();
pConnectionPointContainer->Release();
}

CoUninitialize();

}

This piece of code does not work.
However if i create a separate class derived from IDispEventImpl then there is no problem with the code.However i would like to sink the events in the MFC Document class it self.

Your early reply will be appreciated.

Thanks in advance.


Jafer




Jafer
QuestionUse ActiveX without MFC? Pin
Mike Kronenberg7-Sep-01 16:55
Mike Kronenberg7-Sep-01 16:55 
AnswerRe: Use ActiveX without MFC? Pin
Not Active7-Sep-01 17:48
mentorNot Active7-Sep-01 17:48 
GeneralRe: Use ActiveX without MFC? Pin
Mike Kronenberg7-Sep-01 18:36
Mike Kronenberg7-Sep-01 18:36 
GeneralRe: Use ActiveX without MFC? Pin
Sam C7-Sep-01 18:48
Sam C7-Sep-01 18:48 
GeneralRe: Use ActiveX without MFC? Pin
Not Active8-Sep-01 3:32
mentorNot Active8-Sep-01 3:32 
GeneralRe: Use ActiveX without MFC? Pin
Sam C8-Sep-01 4:37
Sam C8-Sep-01 4:37 
AnswerRe: Use ActiveX without MFC? Pin
Todd Smith7-Sep-01 19:15
Todd Smith7-Sep-01 19:15 
GeneralUnsigned Long and Short Values -- HELP ME Pin
7-Sep-01 6:41
suss7-Sep-01 6:41 
GeneralRe: Unsigned Long and Short Values -- HELP ME Pin
Stan Shannon7-Sep-01 6:53
Stan Shannon7-Sep-01 6:53 
GeneralRe: Unsigned Long and Short Values -- HELP ME Pin
7-Sep-01 7:39
suss7-Sep-01 7:39 
GeneralRe: Unsigned Long and Short Values -- HELP ME Pin
Stan Shannon7-Sep-01 7:52
Stan Shannon7-Sep-01 7:52 
GeneralRe: Unsigned Long and Short Values -- HELP ME Pin
Nemanja Trifunovic7-Sep-01 7:49
Nemanja Trifunovic7-Sep-01 7:49 
QuestionHow to find the users that logged on one domain? Pin
Sandos Ganzales6-Sep-01 16:30
Sandos Ganzales6-Sep-01 16:30 
GeneralAdd to project Pin
6-Sep-01 5:43
suss6-Sep-01 5:43 
QuestionUsing IWebBrowser2 with an already existing instance of IE??? Pin
LukeV6-Sep-01 5:14
LukeV6-Sep-01 5:14 
GeneralProperty Storage(Persistance)(need urgent) Pin
Pankaj Mongia6-Sep-01 0:54
Pankaj Mongia6-Sep-01 0:54 
Question.Net not compatible to Studio6? Pin
Sandos Ganzales4-Sep-01 19:47
Sandos Ganzales4-Sep-01 19:47 
QuestionHow to return Custom Error Messages using HResult?? Pin
3-Sep-01 0:02
suss3-Sep-01 0:02 
AnswerRe: How to return Custom Error Messages using HResult?? Pin
Rashid Thadha3-Sep-01 0:27
Rashid Thadha3-Sep-01 0:27 
GeneralOLE Embedding & Word - Saving The Document Pin
AJ1232-Sep-01 5:01
AJ1232-Sep-01 5:01 
Questionpossible for COM events in VC? Pin
Tim Rymer30-Aug-01 4:53
Tim Rymer30-Aug-01 4:53 
AnswerRe: possible for COM events in VC? Pin
3-Sep-01 21:26
suss3-Sep-01 21:26 
GeneralMarking Active X as Safe Pin
Jared Allen29-Aug-01 16:50
Jared Allen29-Aug-01 16:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.