|
First, thanks for your answer.
I agree with you as regards the server. Furthermore, my server is an NT service and so, it is always kept alive ! (or virtually certain )
I need to know when the crash was caused and what provoked the crash of the clients which can also be server of my NT service. I can not wait 6 minutes to know if a client is dead: It would be catastrophic for my application
Can you supply me an example of use of WaitForSingleObject to test if a call failed ?
Thank you very much.
|
|
|
|
|
I'm developing a system that needs to dynamically call a number of different COM objects without the need to rebuild the service everytime a new object is added.
What I'm proposing is to have a common COM object exposing the generic method for all objects and use multiple inheritence to build each different COM object and override the generic method.
By building the service with the common COM object I can then create the appropriate COM object by getting the CLSID & LIBID from the registry and by getting the base interface have access to the common method.
Two questions.
1) Will this work, am I making it more difficult than it should be or is it a non-starter?
2) Has anybody got any examples of multiple inheritence using ATL. I've been scouring the web and haven't come up with anything half decent.
I've been away from COM for over two years working purely in C++ so I'm a bit rusty so please forgive my stupidity.
Cheers
Darren Mann
|
|
|
|
|
i´m totally ignorant about com, so don´t flame me, please
how do you declare a pointer to an interface whose "name" ( eg. IPicture ) you don´t know. I´m trying to use the real player activeX control, but i can´t find the name on their on-line docs, just the clsid. How do you get to know the names of the methods like the vb ide does. i´ve tried with Ole Viewer, but i couldn´t find anything
thanks
Gabriel
don´t worry, drink happy
|
|
|
|
|
Look in Ole View or the VB object browser
|
|
|
|
|
I have this COM object that behind a firewall the transaction support attribute is "reqired" and I am able to access this COM without any issues. However, to put this COM behind a firewall and I am forced to changed the transaction support attribute to "Not Supported" from "reqired". Are there any known issues or changes that should be implemented to work around this? What can I modify to get this to function correctly.
Thank You,
Coding Away!
David
|
|
|
|
|
Hallo.... can anybody help me to get COM tutorials on web??? i'm new to COM familiar in windows programming
-Hariharan
|
|
|
|
|
|
He all you COM gurus,
can you help a complete retard out of jam.
Hopefully this is related enough to COM to be in this forum.
I was wanting to play around with DirectPLay8.
Taking the SimpleServer Example Code that comes with the
DirectX 8.0 SDk, i am simply trying to transferr the code from Win32 api
and make it a little more modular in a MFC project.
but i ran into the snag of i cant even get COM to initialize.
taking the following line from the sample code
// Init COM so we can use CoCreateInstance
CoInitializeEx( NULL, COINIT_MULTITHREADED );
I get the following compile error:
error C2065: 'CoInitializeEx' : undeclared identifier
error C2065: 'COINIT_MULTITHREADED' : undeclared identifier
these two are defined in objbase.h.
I included all the files from the sample code:
#include <basetsd.h>
#include <dplay8.h>
#include <dpaddr.h>
#include <dxerr8.h>
#include "DXUtil.h"
and all the libs from the project:
dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib
but it still doenst seem to include objbase.h
what am i missing? I just want to make this little line of code Initialize COM
and i will die happy.
thanks
|
|
|
|
|
So it doesnt get defined becuase of the following lines within objbase.h
#if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
WINOLEAPI CoInitializeEx(LPVOID pvReserved, DWORD dwCoInit);
#endif // DCOM
Im not sure what i did wrong and why neither of these (_WIN32_WINNT || _WIN32_DCOM) are not defined in my MFC app that was created by appwizard
if you havnt figured it out yet, i am a complete novice.
Any leads will help.
|
|
|
|
|
I am sorry to have wasted anyones time with this problem.
It was a friggin typo.
Within my project settings for preprocessor definitions i had missed typed
"_WIN32_DCOM"
i had typed "WIN32_DCOM"
but i DID state in my initial message that i was a complete retard.
Thanks.
|
|
|
|
|
Hi All,
My problem is about casting between these types.
the scenario is below.
getdocument -> getactiveelement ->
"it's a frame" I need a way of casting this IHTMLElement to IHTMLElement2 or to IHTMLWindow2
/*
IHTMLElement* pa_el;
...get_activeelement(&pa_el);
CComQIPtr<ihtmlelement2,&iid_ihtmlelement2> pa_el2(pa_el);
I have a dispatch here in pa_el2 but it seems as something is wrong because when I call doScroll, I get errors... if I cast to IHTMLWindow2... it simply returns NULL... (myframe == null)
CComQIPtr<ihtmlwindow2,&iid_ihtmlwindow2> myframe(pa_el);
How can I access to a frame object if I have it as an IHTMLElement?
Please Help...
IHTMLElement and IHTMLElement2 and IHTMLWindow2
|
|
|
|
|
Can someone give me an example how i can connect to a MSDE database throw a COM interface with SQL qustenions.
My problem is:
There is an database based om MSDE and there are diffrent applications who vill store and read data from the database, i will make an COM-interface who access the database with SQL questions.
The meaning of this is to make it so easy as possible to access data to the database, the programmers that programing the applications will not no how the database struture is.
They will connect with a procedure an with a couple op parameters like this:
addfuntion(operator, date, car_typ, modell_number, ......, .....,.....)
There will be a couple of interface with a method in each interface.
I will use COM ATL and SQL in Visual C++.
Please can someone here give me a example of this?
|
|
|
|
|
Use OLE DB or ADO there are plenty of examples out there.
|
|
|
|
|
The company i work for said that i should use ATL, ADO gives more code then necessary.
Please anyone give me some URL:s to my problem.
|
|
|
|
|
Are you using VC++? If so you have all you need. Look at MSDN for OLE DB. In VC++ start a new ATL project and insert a new object, choose Data Access and select Consumer.
|
|
|
|
|
Hi,
I am making use of a COM object. One member function returns a collection. I index the object i need with the 'Item' Function. My problem is the object returned as a variant. And i have little clue how to turn it into the object it show be.
Thanks in advance
Rich
PS
I have little experience! So please make it as simple as possible
|
|
|
|
|
VariantChangeType - So simple you would over look it
|
|
|
|
|
I'm starting with ATL, I've written several 'test' COMs but now I face the following problems. I want to create a COM object (class) that will be used from remote machines (DCOM). The COM will be an out of process server. Let's say my object is named MyObj and the C++ class CMyObj.
1. How do I get the count of open objects?
Should I use a static member variable and increase/descrease it everytime an object is constructed/destructed? If yes (or even if no), where should I put the code for this? In the constructor/destructor of CMyObj or in the FinalConstruct-FinalRelease?
2. How to I prevent a client to create an object of that class based on runtime conditions? For example, in order to disallow more than 10 objects at the same time. Should I throw in the constructor? throw what?
3. What's the best way to destroy my object, even if the client hasn't done so yet? 'delete this;'? For example, if the client passes an invalid parameter on one method, I would like to be able to destroy the object (at least on the srv-side).
4. What happens when (in DCOM) the network layer fails? Is the object on the server and/or client side automatically destroyed? If not, can I catch an event or something (I'm more concerned on the server side) when that happens and ... do what?
5. How can I pass my object (and all the data it holds) through the network? Are there any functions I would have to override (something like ReadFromStream or WriteToStream, I don't know)?
6. What's the best way to inform the client of critical failures of a method he just called? Should all these methods have an [out,retval] long *result? Should I use the IErrorSomething that the ATL object wizard allows you to support? Can I return anything else than S_OK, or is HRESULT used internally from the COM/DCOM layer?
Any help would be greatly appreciated.
Moreover, the one who answers all of my questions, will win a free copy of my free Tetris game;)
|
|
|
|
|
I can't pass up the chance for a free tetris game.
1. Thats one way to do it. Put it where ever you would like. In the ctor you can catch it before creating the object. In the FinalConstruct you can be sure the object was successfully created.
2. Don't throw just return an E_FAIL or some HRESULT of your own creation, using the MAKE_HRESULT macro. You could then set the IErrorInfo for more detailed explaination of the failure.
3. Release the object.
4. Don't know (Damn, there goes the Tetris)
5. Pass an interface pointer. You don't want to pass a 500mb object instance down the wire.
6. You could have a retval or use HRESULTs and IErrorInfo, refer to 2.
|
|
|
|
|
Thanks a lot.
I decided I'll give you a copy of Tetris, since you're so excited about it.
Get it from users.otenet.gr/~gtoub/
Btw, it's for DOS (but works on 3.1,95,98,2000 *maybe, it worked for me*).
|
|
|
|
|
When running my program on a 98 box, everything seems to go through smoothly. When running on a Win2000 box, it crashes. I have isolated a commonality between this issue and few other issues in that somewhere along the line it has to display the MSFLEXGRID OCX control. Does there happen to be an extra step in getting the MSFLEXGRID control registered for Win2000? Or perhaps it is registered and it's just something else. It seems 98 recognizes the control.
Thanks!
Chris
Customer: "It seems you have bugs that are inconsistent!"
Support: "We have a patch that makes them consistent."
|
|
|
|
|
all
Is there any way to catch com event from console app?? a short sample code will be great.
psksvp
|
|
|
|
|
Hi
I have serialized my data into an xml file.Now I want to implement IStorage methods and expose those methods to encapsulate my xml code.
To achieve this what I have to do?I want to pass IXMLDOMDocument pointer
to IStorage methods.Can I do this?or how to do?
Thanks in advance
Pathi
bhikshapathi_g@semanticspace.com
|
|
|
|
|
Why can't you use the IXMLDOMDocument methods load and save?
|
|
|
|
|
I was trying to create a WTL based dialog app that had a DateTimePicker on it but can't seem to get it working. When I try to create the contol all I get in return is NULL.
CDateTimePickerCtrl Date;
HWND hWnd = Date.Create(...)
if(NULL == hWnd)
//What happened?
|
|
|
|