|
Mike Dimmick wrote:
*pSystem = new System();
*ahem*
You forgot an AddRef()
--
My name in Katakana is ヨルゲン.
My name in German is Jörgen.
I blog too now[^]
|
|
|
|
|
Hi all,
I am developing a COM object. Because I have one "base"-object (responsible for communication with one object), and a different object (an array of "base"-objects, I need to develop 2 COM objects.
The best solution would be:
MyCOMObject->GetABaseObject()->PerformAction();
But I think this is not possible in one COM object. So I thought, maybe, if I develop 2 COM objects, it is possible.
My architecture looks like this:
COMObject1 (base class) <-- bi-directional communication --> COMObject2 (array class)
And an application, which can choose what COM to use. If he only needs 1 connection, it can use COMObject1, otherwise COMObject2.
But, can I call functions withing COMObject1 from COMObject2???
Thanks!
Geert
[url]http://geert.yoki.org[/]
|
|
|
|
|
Is there a way in .NET applications to programmatically find all registered com components (or .NET components) that implement a given interface?
|
|
|
|
|
At me such problem:
When the standard page of properties (Property Page) is created - that everything is all right,
And when I try to create it manually - it is not displayed.
I hands finish such in CoClass.h:
BEGIN_PROP_MAP (COpenGL)<br />
PROP_DATA_ENTRY ("_cx", m_sizeExtent.cx, VT_UI4)<br />
PROP_DATA_ENTRY ("_cy", m_sizeExtent.cy, VT_UI4)<br />
PROP_ENTRY ("FillColor", DISPID_FILLCOLOR, CLSID_StockColorPage)<br />
<br />
PROP_ENTRY ("Dialog", 2, CLSID_PropDlg)
<br />
END_PROP_MAP ()
And in a result the Property Page created in manual is not displayed (and that standard "FillColor" - is displayed)......... (are displayed only standard - FillColor, and one more)
What to make, that it worked?
And all over again I received the message, that CLSID_PropDlg is in general a unknown piece (but then itself has passed)
That I receive in a idl-file:
import "E:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\prsht.idl";
import "E:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\mshtml.idl";
import "e:\program files\microsoft visual studio .net 2003\vc7\platformsdk\include\dimm.idl";
import "E:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\mshtmhst.idl";
import "e:\program files\microsoft visual studio .net 2003\vc7\platformsdk\include\docobj.idl";
import "E:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\exdisp.idl";
import "E:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\objsafe.idl";
[
object,
uuid(BB2EEEBB-B474-4CBC-9B70-697E4ECC1EE8),
dual,
helpstring("IOpenGL Interface"),
pointer_default(unique)
]
#line 49 "d:\\d\\c7\\com\\atlgl\\atlgl\\opengl.h"
interface IOpenGL : IDispatch {
#line 52 "d:\\d\\c7\\com\\atlgl\\atlgl\\opengl.h"
[propput,bindable,requestedit,id((-510))] HRESULT FillColor([in] OLE_COLOR clr);
#line 54 "d:\\d\\c7\\com\\atlgl\\atlgl\\opengl.h"
[propget,bindable,requestedit,id((-510))] HRESULT FillColor([out,retval] OLE_COLOR *pclr);
[id(1),helpstring("method GetLightParams")] HRESULT GetLightParams([out] int *pPos);
[id(2),helpstring("method SetLightParam")] HRESULT SetLightParam([in] short lp, [in] int nPos);
[id(3),helpstring("method ReadData")] HRESULT ReadData();
[id(4),helpstring("method GetFillMode")] HRESULT GetFillMode([out] DWORD *pMode);
[id(5),helpstring("method SetFillMode")] HRESULT SetFillMode([in] DWORD *nMode);
[id(6),helpstring("method GetQuad")] HRESULT GetQuad([out] BOOL *bQuad);
[id(7),helpstring("method SetQuad")] HRESULT SetQuad([in] BOOL bQuad);
};
[ version(1.0), uuid(4CA16C3B-D4B6-434D-9648-2E419FF79F15), helpstring("ATLGL 1.0 Type Library") ]
library ATLGL
{
importlib("stdole2.tlb");
importlib("olepro32.dll");
[
uuid(9D2FB6B9-6797-45D0-A331-A6DE808F9A82),
helpstring("_IOpenGLEvents Interface")
]
#line 72 "d:\\d\\c7\\com\\atlgl\\atlgl\\opengl.h"
dispinterface _IOpenGLEvents {
properties:
methods:
};
[
version(1.0),
uuid(35435006-DA95-4B34-9988-5A0A512E3F3C),
helpstring("OpenGL Class")
]
#line 88 "d:\\d\\c7\\com\\atlgl\\atlgl\\opengl.h"
coclass COpenGL {
interface IOpenGL;
[default, source] interface _IOpenGLEvents;
};
[
version(1.0),
uuid(F2FBEB23-A2C0-4C9D-B049-6E14D8A3E8CF),
helpstring("PropDlg Class")
]
#line 19 "d:\\d\\c7\\com\\atlgl\\atlgl\\propdlg.h"
coclass CPropDlg {
[default] interface IUnknown;
};
[
version(1.0),
uuid(CD2867E6-F4C7-48A6-8D06-D1856D501B2E),
helpstring("tMy Class")
]
#line 19 "d:\\d\\c7\\com\\edf\\atlgl\\tmy.h"
coclass CtMy {
[default] interface IUnknown;
};
}
|
|
|
|
|
Do not pay attention to this post, I have already found a mistake
|
|
|
|
|
I have DOTNET project that connect to excel through RTD. After some time say 2 week the excel lose the connection to RTD component
I will be thankful if any body guide me how to solve this problem or how to fiend the reason of it
And thank of all any way
note:
the excel use interop dll to connect to the assembly dll
Aswanee
|
|
|
|
|
Am getting the error "A Tool returned Error,Performing registration" during linking of my interface implementation project file.
can anyone help me out of this???
Hariharan.T
|
|
|
|
|
I have an application downloaded and installed by user.
The main GUI executable uses a secondary COM EXE Server.
During installation (Installshield) I put 2 values into the registry to tell Windows I want this COM EXE Server to run as the 'Interactive User'.
* The reason why this is done isn't the clearest thing to me, apparently It's been done in the past so that this COM EXE Server can run as a service, this isn't the case now.
The application is deployed onto thousands of computers.
Recently I have this guy who installs but fails to run my application on 3 of his computer (4'th one succeeds), my application spits back the error '0x8000401a'.
0x8000401a = The server process could not be started because the configured identity is incorrect. Check the username and password.
From what I understand Windows doesn't really want to allow him to create an instance of my COM EXE Server.
My question is what can be causing this ?
He said he's both a local and network Administrator, nothing problematic (that he can see).
Can someone give me a clue/hint/direction about this error ?
thanks
|
|
|
|
|
How do you derive a class from more than one interface where two or more of the interfaces have methods with the same name, parameters and return type?
class CSomeClass : public IInterfaceA, IInterfaceB
{
public:
CSomeClass();
// IUnknown
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
// IIntefaceA
HRESULT STDMETHODCALLTYPE DoStuff(VOID);
// InterfaceB
HRESULT STDMETHODCALLTYPE DoStuff(VOID); <-- Compiler generates an error
};
error C2535: 'HRESULT CSomeClass::DoStuff()' : member function already defined or declared
If its as simple as only having one copy of the function then how do you know which interface the function is serving? QueryInterface() handles this by passing in an IID but the functions I'm dealing with have no such parameters.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
One way around this problem would be to build intermediate C++ classes that derive from a single interface and impliments the clashing method by making a pure virtual call on a nonclashing name.
For example:
struct IXInterfaceA : public IInterfaceA
{
//Add new non clashing method as a pure virtual
virtual HRESULT STDMETHODCALLTYPE DoStuffOnA(void) = 0;
//impliment the clashing method
STDMETHODIMP DoStuff(void)
{
return DoStuffOnA();
}
}
If you do the same for your other interface IInterfaceB
Your CSomeClass would look like this.
class CSomeClass : public IXInterfaceA, public IXInterfaceB
{
public:
CSomeClass();
// IUnknown
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
// IIntefaceA
HRESULT STDMETHODCALLTYPE DoStuffOnA(VOID);
// InterfaceB
HRESULT STDMETHODCALLTYPE DoStuffOnB(VOID);
};
Hope this help, it helped me.
Regards
Andy
|
|
|
|
|
i got a doubt in sink interface implementation... whether i need to specify a CoClass in the sink interface IDL file??
without coclass decleration how does it knows about where it is implemented??
can anyone help me??
Hariharan.T
|
|
|
|
|
Hi,
I want to POST datas and at the same time open the default browser
so I found code that do the thing :
First I call CoCreateInstance with CLSID_InternetExplorer as argument
Then I call NaviGate with the url and the datas to post as arguments
So InternetExplorer opens and I see the result of the datas I posted.
But now I want to open the defaultbrowser and not only InternetExplorer.
How should I do ?
Thanks.
lasterix
|
|
|
|
|
you will get Default Browser Location here in this registry KEY.
HKEY_CLASSES_ROOT\HTTP\shell\open\command
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Ok thanks, but I don't know how to use it in my case.
|
|
|
|
|
|
|
|
Hi,
I have an ATL COM that is initialized with CoInitializeEx(NULL,COINIT_MULTITHREADED) thus its multiple apartment COM and calls can be made simultaneously from different clients.
When I initialize and call it from an application, no problem.
When I initialize and call from 2 different applications- no problem as well.
But when I initialize it in one application and then try to initialize or call it from another thread in the same application, I get the following error:
"the application called an interface that was marshaled for a different thread"
What can I do to solve it? Should I change the way I call it?
Thanks.
avivhal
|
|
|
|
|
the CoInitialize(Ex) initializes the apartment for the thread - you also need to mark the type of apartment for the object. If you create it in ATL, the wizard asks you if you want to create single/multithreaded object.
You need to have Free threaded object and free threaded thread to achieve no marshalling.
|
|
|
|
|
Did you call CoInitializeEx(NULL,COINIT_MULTITHREADED) in that thread ?
|
|
|
|
|
Is Automation the only major concern between IDispatch and IUnknown??? or anything else hiding in??
Hariharan.T
|
|
|
|
|
One small thing to know - IUnknown is a base interface from which every interface should either directly or indirectly derive. Even IDispatch is derived from IUnknown.
Best thing according to me would be trying find/understand why IUnknown is really required and same abt IDispatch. This will help you understand them better.
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hi Sohail Sir!,
i Would also like to knwo in what case IUnKnown is better and in what case IDispatch is better.
Thanks
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi!
IDispatch was designed for usage from script languages. If you look into details, how does it work, you'll find that intent easily.
So answer to your question in COM borders is quite impossible - IUnknown cannot be better than IDispatch , because when you use the IDispatch , you use the IUnknown as well. But it's worth of use if you talk to script languages (VB counts here as script language)
The core parts of the IDispatch are GetIdsOfNames and Invoke . The whole IDL part is just an add-on to the automation part, I can describe that if you want (this post is quite long anyway)
|
|
|
|
|
Hello Sir!
I think, I got something in my mind from your above Post.if any problem come in my way,I think I am going to agian knock your Door.
Thanks.
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|