|
<br />
WINOLEAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR* lplpszProgID);<br />
|
|
|
|
|
If you just have the IDispatch interface you may be out of luck. It all depends on what else the object exposes. It may expose a DISPID which will tell you something about the CLSID/ProgID (doubtful), or it may implement an interface such as IPersist (which has a nice function called GetCLSID), from which you can acquire the CLSID.
--
Denn du bist, was du isst!
Und ihr wisst, was es ist!
Es ist mein Teil...?
|
|
|
|
|
It would be really appreciated if anyone could explain me how to connect number of client application to the same instance of an out-of-process COM server. The client applications must be able to share the data via the COM server, as well as call the COM server methods.
|
|
|
|
|
|
Another way of connection to an out-of-process COM server is to use the ROT (Running Object Table). You'll find more info about the ROT in the MSDN docs.
--
Denn du bist, was du isst!
Und ihr wisst, was es ist!
Es ist mein Teil...?
|
|
|
|
|
With all due respect, was anyone ever able to find "more information" in MSDN docs?!
|
|
|
|
|
See GetActiveObject() & co
--
Denn du bist, was du isst!
Und ihr wisst, was es ist!
Es ist mein Teil...?
|
|
|
|
|
hi..
To make an out of process com compenent single instance, it needs just one line. Include DECLARE_CLASSFACTORY_SINGLETON(CUrClass) macro into the header file of ur coclass defenition header file, just below that DECLARE_REGISTRY_RESOURSEID...... macro..
Then the first CoCreateInstance call will create that object. All succeeding call to CoCreateInstance will return the same instance only... hope this is what u r looking for...
rgds...mil10
|
|
|
|
|
hi gurus,
I would like to know the difference between COM and COM+. I would appreciate if could get a detail description of each one of these. And I want to know whether all the features of COM are there in COM+.
Thanx in Advance,
Ravi.
|
|
|
|
|
hi ravi..
actually com+ is a framework which enhances the usage and scope of com components. Its not a binary standard like COM or a next version of COM. Its just the next vrsion of MTS.
In com, a dll is an inproc server. but by adding that inproc dll to the com+ framework we can make it out of process for scalability, almost similar to surrogates in com
Hope u r more familiar with Vb than vc, So consider the case of vb com method UpdateSales, in which u uses the ado connection object for transaction handling. here suppose u call some other two, three methods within UpdateCustomer and these internal fns: also uses transaction. Her the internal functions commited the transactions inside.
Then in the outer fn: suppose u want to roll back the transactions, tehn u can roll back only those transactions in the outr fn:, u can't roll back the transactions in the inner fns: that alredy got committed.
But COM+ is smart enough to handle this situation. Just group all these COM methods into a single transaction in COM+. Suppose the outer method need a rollback , then COM+ will roll back the transactions alredy committed in the previous COM methods also.
Not only thsi transaction handling.. Message queing, queud components, event subsscribing and lot more..... As a bottom line COM+ is for distributed, scalable thin client app development, the NextGen of Client-Server development paradigm..
rgds... mil0.
|
|
|
|
|
Microsoft came out with COM, which was nothing but a specification. Components built in any language according to this specification can be used with a client in any other language. So the programmer does not have worry about creating a single executable, since the component is identified by means of GUID (Global Unique Identifier), a 128-bit number that is stored in the system registry, along with other relevant information, to uniquely identify the component
COM+
In order for an enterprise application to be able to use COM, it has to have certain capabilities like:
Authentication
Object pooling
Transaction management
Support distributed architecture
Microsoft came out with DCOM (Distributed COM) and MTS (Microsoft Transaction Server) so that the developers don't have to add these capabilities to their components. Using the above two technologies, they can concentrate on writing the business logic instead of the background plumbing for their components
DCOM is an RPC (Remote Procedure Call) protocol used for communication between distributed components. Here the client makes requests to a proxy class on the local machine, which then delegates the call invisibly to a remote stub class installed on a remote machine
MTS is integrated with Microsoft's Windows 2000 OS under the new name COM+. But COM+ isn't just MTS; it also includes a host of other services. MSMQ (Microsoft Message Queue Server), which was released around the same time as MTS, is also integrated with Windows 2000 under COM+. MSMQ allows for asynchronous communication between clients and servers, which absorbs the impact of server inaccessibility. Event Service was added so that server classes can asynchronously communicate event occurences to multiple clients. The Load Balancing Service automatically instantiates requested objects on the machine that has the most available resources in the server farm.
i think you get bored of this but the theoritical facts are these.
All the Best!
|
|
|
|
|
Microsoft came out with COM, which was nothing but a specification. Components built in any language according to this specification can be used with a client in any other language. So the programmer does not have worry about creating a single executable, since the component is identified by means of GUID (Global Unique Identifier), a 128-bit number that is stored in the system registry, along with other relevant information, to uniquely identify the component
COM+
In order for an enterprise application to be able to use COM, it has to have certain capabilities like:
Authentication
Object pooling
Transaction management
Support distributed architecture
Microsoft came out with DCOM (Distributed COM) and MTS (Microsoft Transaction Server) so that the developers don't have to add these capabilities to their components. Using the above two technologies, they can concentrate on writing the business logic instead of the background plumbing for their components
DCOM is an RPC (Remote Procedure Call) protocol used for communication between distributed components. Here the client makes requests to a proxy class on the local machine, which then delegates the call invisibly to a remote stub class installed on a remote machine
MTS is integrated with Microsoft's Windows 2000 OS under the new name COM+. But COM+ isn't just MTS; it also includes a host of other services. MSMQ (Microsoft Message Queue Server), which was released around the same time as MTS, is also integrated with Windows 2000 under COM+. MSMQ allows for asynchronous communication between clients and servers, which absorbs the impact of server inaccessibility. Event Service was added so that server classes can asynchronously communicate event occurences to multiple clients. The Load Balancing Service automatically instantiates requested objects on the machine that has the most available resources in the server farm.
i think you get bored of this but the theoritical facts are these.
All the Best!
|
|
|
|
|
Hello,
I'm wondering if anyone could have a hint that could put up the light on me.
I've created a COM Service (COM Server & Service) and all works superbly. I access the objects on the COM service using IIS. I used to be able to debug my process as a Local Server instead of a Service by using the "-debug" command line option and that allowed me to see my coding mistakes. But i've come to a point where it works only as a Service and not as a Server.
If i use VBA from MS-Excel, i can access my object but not from IIS JScript where i used to be able to before.
Hmmmmm .. maybe if i completely unregister my proxy/stub DLL .. guess i'll try that tonite
|
|
|
|
|
I access the objects on the COM service using IIS
hope u fixd it already.. i dont understand anything, what u mean by accessing it from IIS-JSscript..
rgds..mil10.
|
|
|
|
|
What i mean is that in IIS, if i have a server side script from which i try to instantiate my base object like:
var obj = Server.CreateObject("my.progid");
this will fail if i start my object as a server but works if it is a service. Very weird actually. Haven't had a chance to work on it yet, but i'll keep you posted.
|
|
|
|
|
Ok..ok DB, let me know how u come over that... Actually i havnt tried NT services using com exe.
But a reasonable doubt is, if the com server is running as an nt service under local system account, how can u create objects of classes in that server. because our client programs are under the users account right?, and the Nt Service is under Local system account.
rgds..mil10
|
|
|
|
|
Heheh .. the answer is simple
<br />
::CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE,<br />
RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL);<br />
This is in my Service_Main code just after CoInitialize(NULL)
Havent been successfull at making it work as a Local Server even after doing a full rebuild of:
1) COM Server (which is also my COM Service)
2) COM Stub/Proxy
3) IIS Filter
It used to work fine and suddenly stopped working. But its probably a little something i bugged when i toyed my registering procedure to register my LocalService key under AppID.
My COM Service is in pretty good shape now. I've learnt a great deal about COM and how to handle it. Eventually i might need to bring it forward as a DCOM application but its not a requirement yet
I appreciate all the help i've been getting from you and any others that did help me find answers, even if it wasnt done directly, like when i browsed the great articles of CodeProject. I try to repay by helping others when i can.
|
|
|
|
|
Hi db ... Congrats... keep it up and learn more...
I can understand ur raising confidence in COM programming day bi day.. keep it up... best wishes ... mil10.
|
|
|
|
|
Morning all!
I'm having a bit of a problem with the IDL file generated by VS. I'm using VS7.1 to create a COM object, but I need to edit into the IDL a importlib("") statement. This is needed as I am using another interface from another COM library.
My problem is that everytime I edit the IDL file, then build the project, the IDL file gets recreated, erasing any changes I've made!
I know I'm missing something obvious here. Any help?
I Dream of Absolute Zero
|
|
|
|
|
Ok, I've managed to locate the [importlib("")] attribute that places the corresponding entry in the IDL file. But I'm still getting unresolved type declarations from the MIDL compiler.
What are the other steps necessary to declare external COM type libraries?
Using VS7.1 C++ environment, if that makes a difference.
I Dream of Absolute Zero
|
|
|
|
|
Hi Rich!
Have you found how to do that? Keep me posted if you do!
Beers on the agenda?
Speak soon,
Jerry (the bad)
|
|
|
|
|
Hey! Welcome back!
Sorry, I still haven't found a definite solution. MSDN is great at some things, but crap at real world COM tutorials/documentation.
I decided to compromise and use an IUnknown** parameter instead (which I then QueryInterfaced for the required interface).
Beers are always on my agenda. Maybe towards the end of the month (next week onwards) we can catch up.
I Dream of Absolute Zero
|
|
|
|
|
hello
at first i´ve to excuse my bad english, i´m from germany
i have a problem with programming com-atl-components.
i want to programm a .dll file for vb in c++. this dll should work with strings. so i look around the www and i found this:
http://www.codeproject.com/string/comstring.asp
i know, it´s the easiest way, but after a week of searching, trying and not working, it is enough
so, my problem is: how can i use this, built in in a dll?
you know, when i make a point behind a CString object in c++ there comes a list with all the methods in the class...this is what my boss wants in vb, but i think, at first it have to work in c++.
so, please help me
enrico
|
|
|
|
|
Not sure what you want to do but let us try
a) Create an empty ATL or Com object called StringForMyBoss
b) Add to this object a property called value of type BSTR
c) Add to this object all the member functions designed in that class so you can use them from VB
Seems a bit overkill knowing that most of these functions exist in VB... but good luck!
Good luck,
Jerry
|
|
|
|
|
mmmhhh, slowly i think, i´m stupid..
i´ve try it and something works...well, in c++. i´m not ble to progamming vb and so, its the job of the boss.
you call it overkill? mmhh, boss said, in vb the stringoperations (esp. append) are too slow, c++ is more than faster...so enrico, you´re the trainee...create a dll that works for me...
i´ve never heard about this...and after more than 50 hours of searching you and another (from germany) helped me...in c++ it works, but in vb...well, it´s the boss´game
|
|
|
|