|
Hi,
DCOM is a Client calling a component on another computer called Server. When we talk about Events, the roles should be changed, the client will be the server and the server will be the client(Security wise). Goto this article, it might help you in this problem.
http://www.codeproject.com/useritems/dcomcnfg.asp
Don't forget that while configuring the client and the server, you have to give the server the required security privileges to call back the client.
Regards,
ShadiK.
Shadi Al-Kahwaji
|
|
|
|
|
Thanks Shadi...
Giving the Server the required Security Rights made it work...
|
|
|
|
|
Hi,
I have an MFC application (exe) containing an ATL COM object (ATL support added to the project). that I want to be able to use from another application. I have created a proxy/stub dll and registered both in the registry but when I try to create an instance of the object it returns E_FAIL. What could I be doing wrong?
Johannes
|
|
|
|
|
Start from the top
Have you called
if (!AfxOleInit())
return TRUE;
from your MFC app (called from InitInstance) ?
|
|
|
|
|
Hi,
I am trying to use list view in a property page which is created in ATL for display in a MMC snapin. I opened the property page in the resource view,
added the list view control from the list . Now my cpp file cannot compile
and it gives me error error C2367 in the tlh file.(REdefinition of interface)
In the cpp file I found that the following line is included.
#import "C:\WINNT\System32\Comctl32.ocx" raw_interfaces_only, raw_native_types, no_namespace, named_guids
I commented out everything after "...\Comctl32.ocx" , the project builds, but the propery page does not show anything. Not even the rest of the controls in the page.
Can somebody help this novice programmer on this issue ? I would be really greatful.
Thanks,
Sameer
|
|
|
|
|
Are you calling InitCommonControls() or InitCommonControlsEx() before the listctrl gets created?
I'm an alien, I'm an alien
it's a beautiful life....
Bush
|
|
|
|
|
I called these functions but it did not work.
Actually I am trying to put list view activex control in the page.
I found the reason from somebody that properysheet
class CSnapInPropertyPageImpl is derived from CDialogImpl instead of
from CAxDialogImpl in which case it would have worked.
|
|
|
|
|
When I inserted a new JPG picture into the OLE Control, it just shown me an icon, but when i inserted a BMP picture it shown me the content of that picture. How can i insert a new JPG picture into the OLE Control and see its content not its icon
|
|
|
|
|
The following is the simplified code:
#include <objbase.h>
interface ix:IUnknown
{
virtual void __stdcall fx()=0;
};
class Try:public ix
{
public:
HRESULT __stdcall QueryInterface(IID& iid,void** ppv){return S_OK;}
virtual ULONG __stdcall AddRef(){return 0;}
virtual ULONG __stdcall Release(){return 0;}
virtual void __stdcall fx(){}
Try(){}
};
void f()
{
Try ptry;
}
--------------------Configuration: try - Win32 Debug-------
d:\files\vc\com\try\try.cpp(23) : error C2259: 'Try' : cannot instantiate abstract class due to following members:
d:\files\vc\com\try\try.cpp(7) : see declaration of 'Try'
d:\files\vc\com\try\try.cpp(23) : warning C4259: 'long __stdcall IUnknown::QueryInterface(const struct _GUID &,void ** )' : pure virtual function was not defined
d:\microsoft visual studio\vc98\include\unknwn.h(109) : see declaration of 'QueryInterface'
d:\files\vc\com\try\try.cpp(23) : error C2259: 'Try' : cannot instantiate abstract class due to following members:
d:\files\vc\com\try\try.cpp(7) : see declaration of 'Try'
d:\files\vc\com\try\try.cpp(23) : warning C4259: 'long __stdcall IUnknown::QueryInterface(const struct _GUID &,void ** )' : pure virtual function was not defined
d:\microsoft visual studio\vc98\include\unknwn.h(109) : see declaration of 'QueryInterface'
**********************************************************
I really don't know what's wrong with the code.
|
|
|
|
|
Hi,
The thing that you didn't get about COM technology is that "you will not deal with classes any more, what you have to care about is interfaces". Here you are trying to create an instance of Try class, which is wrong in COM world. You have to ask the component for a certain interface, and the component itself will create the class instance for you, and it will cast it to the required interface.
To access your component you have to make a call like this one:
{
IX *pX; //See, you are defining the interface instead of the class
HRESULT hr = CoCreateinstance(CLSID_Try, NULL, CLSCTX_SERVER, IID_IX,(void**) &pX);
pX->fx();
pX->Release();
}
Regards,
ShadiK.
Shadi Al-Kahwaji
|
|
|
|
|
Thank you for your reply.
|
|
|
|
|
I'm totally new to COM and I want to know of some good starting reference information (online articles, books, sites).
The problem I want to address is interfacing a VB application with my VC++ app. I will be sharing data between the two apps, probably in the form of a linked-list structure (on VC++ side) and an array (on the VB side.)
Thanks for the help.
Johnny
|
|
|
|
|
I am designing a module and I want to know if this is a good design or not. My conerns are that I will be conflicting with the COM threading architecture.
Could anyone tell me if this is ok? :
I have an object, IQueue which has a method IQueue::Add([in] long nID)
IQueue is an MTA, meaning that its methods could be called multiple times simaltaneusly.
long nID will be added to a vector<long>. Adding to the vector<long> is thread safe. (using my own protection mechanism)
Till there I am fine.
Now, here is where I need help.
When IQueue is initialized, I want to create a thread that will scan this vector<long>, pick up the longs from it and do something with them.
Is it OK if I create a new thread from within IQueue? (this new thread will only be accessible internally from IQueue)
Any thoughts?
Thanks!
Jeremy.
"Hey man, Taliban, Tali me Banana."
|
|
|
|
|
Hi,
There are two things (as I saw from what you have said) that you have to care of:
1- Once you have created a new thread (withing an MTA or STA), this new thread does not know anything about COM Runtime Environment, this means that you have to call CoInitialize(0) or CoInitializeEx(0, ..).
2- Also this new thread cannot access your Vector, you have to pass this vector to the new thread.
This is what I can say about your problem
Enjoy,
ShadiK.
Shadi Al-Kahwaji
|
|
|
|
|
1) Ok, no problem. Thanks for pointing it out.
2) No problem there, I have a mechanism to do that.
Thanks!
Jeremy.
"Hey man, Taliban, Tali me Banana."
|
|
|
|
|
This is a real nitpicker's comment...
But "IQueue is an MTA" is not a valid statement. IQueue is an interface, and it can be implemented by many different COM objects. Each of these objects will have their own threading model.
I assume what you mean is "I have an object with an IQueue interface, and the object's threading model is MTA."
As for your question, what you are doing is a-OK, just make sure you do indeed specify the object as free-threaded. The first time something similar to what you are doing here, I had specified in the ATL wizard "Both" - and so when the object was instantiated by an object in an STA evil things began to occur .
|
|
|
|
|
Hi All!
I'm trying to add some Text To Speech and Speech Recognition capabilities to a VC++ software.
I've installed a TTS and a SR software, but they are accessible through COM objects.
The OLE View tool gives the description of these objects.
I've tried to add one of these COM objects into my software, using the following method :
- add it with the ClassView tool (choosing the corresponding DLL : ClassView
creates and adds the corresponding .h and .cpp files
- use the 'classical' COM client code :
1) OleInitialize()
2) CoCreateInstance()
The CoCreateInstance() fails and returns the following error 'ClassNotRegistered'.
As I'm a pure beginner in COM technology, I need some help for this part of my
project.
Thanks.
|
|
|
|
|
Are there any C++ samples with the TTS/SR software you are using? Do these work. It sounds like the COM object haven't been registered. Is this Microsoft Speech SDK you are using?
The only question mark over what you seem to be doing is that I use CoInitialize rather than OleInitialize.
Michael
|
|
|
|
|
No (no C++ samples code using the TTS and SR software).
The SR comes from IBM ViaVoice, and the TTS comes from Learnout and Houspie.
But to begin with COM, I tried to implement a simpler TTS object : Xvoice.dll.
The UUID is given by the Ole View Tool, but I'm not sure that this object is
registered.
It would be helpfull for me if you accept that I send you this dll, so that you can try by yourself and give me the information for :
- getting the right UUID of a COM object
- check the registering or register a COM object
- use it in a C++ software (getting the interface and initializing).
I've tried to do this, using the samples found in the MSDN package, but without success.
Many Thanks
|
|
|
|
|
Have you tried to manually register the components with regsvr32? What was the response?
|
|
|
|
|
Hi all,
Please, can I find somebody to help me in this problem, I'm using a custom made ATL component, I have the .h and .c, and I have put some create instance statments in my COM Client, but always I face this compile error on each create instance command :
error C2259: 'CMyClass' : cannot instantiate abstract class due to following members:
warning C4259: 'long __stdcall IUnknown::QueryInterface(const struct _GUID &,void ** )' : pure virtual function was not defined
Anybody can help in this problem?
Yours,
ShadiK.
Shadi Al-Kahwaji
|
|
|
|
|
What does your CreateInstance code look like?
The error is saying that your class hasn't implemented the IUnknown methods, QueryInterface, AddRef etc. However if you are trying to create a instance this shouldn't be happening as your COM DLL should have the implementation.
Are you using smart pointers, #import or using CoCreateInstance?
Michael
|
|
|
|
|
Hi,
First thank you for your reply.
Actually I'm using a ready made component which I don't know anything about how does it implemented, but I have the component.h and component_i.c files, and I'm linking to the component using these two files and the ofcourse the .DLL itself. No #import, no smart pointers, just CoCreateInstance which directly creates the required interfaces, and on those CoCreateInstance statement I have this error.
Regards,
ShadiK.
Shadi Al-Kahwaji
|
|
|
|
|
I need to see the CoCreateInstance code fragment to help more. It seems like you are trying to create the c++ class instead of the interface.
Michael
|
|
|
|
|
Can you post some of the problematic code? Usually that error happens when you try to use use new to create an ATL class, which is the wrong way to do it, but you said you're using CreateInstance.
Does the class have a BEGIN_COM_MAP()/END_COM_MAP() section?
--Mike--
http://home.inreach.com/mdunn/
your with and
|
|
|
|