|
_ConnectionPtr is smart pointer
(_com_ptr_t<_com_IIID<_Connection, __uuidof(Connection)> >).
Just do it
m_connection = rhs.m_connection;
and _com_ptr<>::operator =() calls QueryInterface himself
|
|
|
|
|
I have 2 dll 's which are using the same structure and same interfaces
but i want to write one client.
I included the headers generated by the idl 's in my client i am getting redefination of structures.
Is there any way where I can access both the DLLs using a single client.
The DLLs share the same structures and interfaces
Thanks for any help
parag
|
|
|
|
|
Yes you can . You will have to use namespace under this circumstance
Jafer
|
|
|
|
|
How do you pass a "C" type struct to a visual basic active X dll? I have looked at the tutorials on the site for passing simple system-defined datatypes but get problems with the MIDL compiler if I try to pass a structure. How does one do this? i.e. I create my active x dll and then get the .idl file from the ole viewer and try to run midl to create header file for me but that's where it goes wrong complaining about the type there. Is there an article on this somewhere?
|
|
|
|
|
Hello,
declare the structure in ur MIDL file and then in client side VB code there is something called as *type* data type. this is similar to a structure. declare this in the format as ur structure and create an instance for it and use it. this worked for me in COM dll/VB client and so i think it will work in VB activex client also.
Ganesh.M.Ramaswamy
|
|
|
|
|
Hi,
I might look a bit selfish here, but,
have you tried this ?
www.codeproject.com\atl\udtdemo.asp
Hope this helps
|
|
|
|
|
Suppose a client connected with a remote DCOM component by creating its instance and then calling its methods, can the component know where the client comes from, or what IP the client has? If can, how? And when firewall exists in the client side, how is the situation then?
Thanks a lot!
|
|
|
|
|
hello,
As far as i know the basic design of COM/DCOM is that both client and server should be unaware of the other and as i suppose COM doesnt give any direct interface/method for getting IP address (though it does these things internally). i also think that there wont be any need for a COM component to trace the client.
Ganesh.M.Ramaswamy
|
|
|
|
|
hi
I am a beginner to ATL .I cant call the control's property pages in 'Active control test container' and VC++ ,but can do that in VB.How will i do to perform that?
|
|
|
|
|
hi
I am a beginner to ATL .I made a Active control with ATL.
I can call the control's property pages in 'Active control test container' and VC++ ,but cant do that in VB(the context menu dont contain the 'Property' item).How will i do to perform that?
|
|
|
|
|
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
|
|
|
|
|
Hello -
We have a C/C++ app witten with plain win APIs (no MFC). A nice enhancement to the project would involve the use of an ActiveX control by Infragistics. Question: Can an ActiveX control be used and accessed from plain C/C++ in an existing program that doesn't use MFC? If so, where could we find some "how to" information and possibly sample code?
Thanks,
Mike
|
|
|
|
|
where could we find some "how to" information and possibly sample code?
Everywhere, there are samples all over this site, and others, that use COM without MFC. ActiveX, or COM, is not dependent on MFC. Here is a hint, Coinitialize()
|
|
|
|
|
Mark,
Thank you for your reply. I spent some time on this great site but have to admit that I unfortunately didn't encounter the many samples you mention. Please help me in my obviously blind and confused search .
I understand the usage of CoCreateInstance() and CoInitialize(). I am puzzled however for example by how events are passed from the ActiveX control back to the C code.
Thanks in advance for the hand holding.
Mike
|
|
|
|
|
The book ATL internals had some actual samples of using something along this line using ATL. I know ATL is still a library but it is independant of MFC and is much smaller.
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
|
I totally agree, I have that book as well Those are the only two books I use as an ATL reference suite.
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
|
I am VC Developer and I am working on a COM wrapper for a DLL that we have.... I need to be able to pass DWORD (unsigned long) and WORD (unsigned short) values into this COM DLL.
THe Problem is that the DLL has to be able to be used from VB...When I compile my COM DLL and try and use the functions in VB it reports that VB does not support the automation type...
Any help you could give me would be greatly appreciated..
Joe Wiemann
Software Engineer
Daktronics Inc.
|
|
|
|
|
Can't you use the Variant type?
"Want to know what makes me mad? Everything!" The Ranting Swede.
|
|
|
|
|
|
I agree completely, I never use them, but then I don't do COM. I just thought that the entire purpose of the variant type was for compatibility between the C world and the VB world.
"Want to know what makes me mad? Everything!" The Ranting Swede.
|
|
|
|
|
There are no unsigned types in VB. Can you convert them to their signed counterparts before you pass them?
I vote pro drink
|
|
|
|
|
How to find the users that logged on one domain?
Which funntion or api to use?
sandos
|
|
|
|
|
Cannot add files to project.
It raise an exception and close.
|
|
|
|