|
Look at the MSDN KB article Q181845.
"HOWTO: Create a Sink Interface in MFC-Based COM Client".
regards,
Prem
|
|
|
|
|
Let me know if you get really stuck. Connection Points are just as unbelieably hard to handle in MFC applications as they are easy in VB. I can give you some details or examples if you need it.
|
|
|
|
|
We have implemented a com client in VC++ and it should communicate with server that developed in Delphi(.dll).
The Scenario is as folows
-------------------------------------
A button click on com client(vc) will invoke the com server (Delphi interface)(dialog based).
which will display a dialog were user can interact.Thus by the button click on VC client(dialog based) can invok multiple instances of delphi server.
Now we need to delete or close all the instances of com server with a single click in vc client (com client)
how it is possible ?.
Thanks in Advance
eby
|
|
|
|
|
Hello Eby,
What kind of server is it? (IN/OUT of process)
Can you provide more details?
Regards,
/_henrik
Henrik Sternberg, Consultant
Cambridge Technolgy Partners, Germany
www.ctp.com/ce
henrik.sternberg@ctp.nospam.com
(take away nospam)
|
|
|
|
|
Hi,
Since the Client invokes the server application,
u could have a the interface pointers stored in a
list and close all of them when ever u want to.
But this sounds probably too easy or may be i am not
aware of any additional details where u r facing problems
but from ur q's these should work.
regards,
Prem
|
|
|
|
|
Hi, I'm creating a worker thread in my ATL Object, and all the events seem to be getting handled right at the end. This has happened with many other people, and there are plenty of "What to do's" but not "How to do it".
So i'm trying to use a GlobalInterfaceTable which supposedly is the easiest and i'm trying it "last" (hoping this will be the last).. i tried using CoMarshalblahblah() but it still does the same thing w/o using those functions by just passing object through the LPARAM of CreateThread().
So anyways, it crashes in OLE32.exe when i call GetInterfaceFromGlobal(). It seems to get the Cookie fine and everything, but... when that function is called... it crashes.. and i dont know what i'm doing wrong... it's really frustrating cuz i've worked on this for a LONG TIME... so I think some source sample would be awesome. a few things:
********
# Where do i call CoCreateInstance() & GetInterfaceInGlobal()? From the function that creates the thread or from inside the thread? (i assumed it would be in my Function that creates the thread.
# I only have one of these objects right at the moment, so i just made the DWORD g_dwCookie "global", and I was passing the GIT through the LPARAM of CreateThread() and then calling
GetInterfaceFromGlobal(cookie, IID_ISpyder, (void**)Spy);
*for the record Spy is just a ISpyder *Spy = NULL; that's ok right?
Coolio, anyone lemme know if you can help me! Source or advise is cool! Thanks in advance!
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
Hi,
1- If you make the variable global why passing it in the LPARAM of createThread ?
Normally , or you make a variable global or you pass the variable thru the LPARAM.
2- Normally, with multiple threads in a process a guy must protect the data with a critical section or with another sinchronization stuff ...
3-It's necessary to call CoCreateInstance and RegisterInterfaceInGlobal on the apartment where the object lives
4- It must be GetInterfaceFromGlobal(cookie, IID_ISpyder, (void**)&Spy)), you forgot the ampersand
5-You can call RevokeInterfaceFromGlobal from any apartment, but you must be certain that is the last apartment that makes use of the interface pointer
Hope this helps, best of luck
Joao Vaz
|
|
|
|
|
the only thing global is the cookie, i went ahead and made the GIT a member in my class, and passed it in through the LPARAM. but i didnt put my ampresand in there though. gonna try the stuff out now...
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
now when i call RegisterInterfaceInGlobal() - what should i pass in the first parameter? What do i do & How do i do it?
Do i just call QueryInterface? all i'm wanting is ISpyder but i'm in a CSpyder function... how do i do all that?
right now to get some kind of pointer, i call query interface and then pass an IUnknown *unk = NULL ---> (void**)&unk <--- into the function.
Thanks again..
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
now when i call RegisterInterfaceInGlobal() - what should i pass in the first parameter? What do i do & How do i do it?
Do i just call QueryInterface? all i'm wanting is ISpyder but i'm in a CSpyder function... how do i do all that?
right now to get some kind of pointer, i call query interface and then pass an IUnknown *unk = NULL ---> (void**)&unk <--- into the function.
Thanks again..
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
i got it working. who knows how, but if anyone else has this problem i can work with anyone now about it. i know what to do now. thanks a bunch.
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
Good for you Tim Rymer
COM it's a beast to learn ,I readed 8 books on COM/ATL to be proficient
Regards and happy COM coding
Joao Vaz
|
|
|
|
|
Hi,
How to set the identity user of a COM component using VC++?
Thanks,
- xico -
|
|
|
|
|
Hi,
I created a dialog box using the ATL Object Wizard choosing the category Miscellaneous and the object type Dialog. The result of this action was a dialog implemented by a class that specializes the template CAxDialogImpl<...>. This dialog is showed in a method of another COM object created as SimpleObject. The SimpleObject component is instantiated in an MS Word macro. When I install my program in a machine without Visual C++ installed the program breaks down. I am sure that the COM support is installed, because when I run another component in the same way, but not using this kind of Dialog, the program does not break down. Can anybody help me?
Thanks in advance,
Márcio Azevedo.
|
|
|
|
|
Make sure your components have been built in release mode not debug. Does your dialog use any controls that have been installed on the build machine but not on the target?
|
|
|
|
|
How was the object compiled. Release Min Dependancy or Release Min-Size? Min-Size requires ATL.DLL to be registered on the system. What about the run-time library version it was compiled with, was it Multi-threaded. I've had some problems with systems missing msvcp60.dll
Michael
|
|
|
|
|
I am try to pass a variant as a parameter on a connection point, but at the moment I am having little success.
Does any body have any idea if I can do this ?
|
|
|
|
|
We have implemented a com client in VC++ and it should communicate with server that developed in Delphi(.dll).
The Scenario is as folows
-------------------------------------
A button click on com client(vc) will invoke the com server (Delphi interface).
which will display a dialog were user can interact.Thus by the button click on VC client can invok multiple instances of delphi server.
Now we need to delete or close all the instances of com server with a single click in vc client (com client)
how it is possible ?.
Also there is problem of how the com client (VC) should identify any event occured, on which delphi interface.
Is there any way of identifying it ?.
|
|
|
|
|
If I use the ATL COM AppWizard to create an HTML Control and then embed it in a web page it shows up fine on the monitor, but never prints to the printer. Does anyone know what's going on with that? And while we are at it, the default HTML Control project generates a sample control with 3 buttons labeled Red, Green and Blue that when clicked generate the error "Object doesn't support this property or method". Has anyone else experienced this?
|
|
|
|
|
I have a VB application which uses COMponent written on VC++. COMponent implements IConnectionPoint and creates additional threads. Pointer to [source] interface _IOutBound is correctly marshalled between main thread and additional ones.
The problem arises when VB calls Release (and --m_Ref==0). COMponent waits for threads to end and VB cannot serve call to _IOutBound since it is waiting in COMponent. And if one of the threads calling for _IOutBound - I got deadlock.
How can I prevent that deadlock?
--
Alvin777
|
|
|
|
|
Hi,
I'm having some problems using connection points with DCOM. I have an ATL component that contains a connection point used to send events back to the client. When I instatiate it locally it works, but when I instantiate it remotely an error (E_ACCESSDENEID) occurs calling the method DispEventAdvise of the client event handler passing the container component. Can anybody help me?!?
Thanks in advance,
Marcio Azevedo.
|
|
|
|
|
Hi Marcio,
Do you configured access control on the remote computer using DCOMCFG ?
If not , it gives the infamous E_ACCESSDENEID
Hope this helps,
Joao Vaz
|
|
|
|
|
Hi,
I am using a Audio Player ActiveX in VB and VC++ 6.0.
In VB the control runs fine, but in VC++ the control freezes the window
when I play a song.
I'm using CreateInstance method in VC++ to instantiate the control
Can someone tell me what I should do?
Sansky
|
|
|
|
|
Some controls do not have the "windowless activation" feature (they need a window to function correctly). This may or may not be your problem.
Instead of CreateInstance, have you tried to insert the control onto a dialog template in your project? Assuming you are using the control in a CDialog derived class:
1. Click the project menu.
2. Select "Add to project" then "Component and controls".
3. Browse to select your ActiveX control.
4. The above steps will generate a C++ wrapper class derived from CWnd and also place the control on the resource toolbar, you can drag it from there onto your dialog template.
5. You can add a member for this control to your CDialog derived class.
|
|
|
|
|
Hi all,
I am suffering from a Read/Write stream operation with CComVariant.
Here is the problem. I create a stream like this:
CreateStreamOnHGlobal(NULL,TRUE,&m_pStream)
then I write to it a VARIANT through CComVariant (in doesn't matter which type it is) like this
m_comVariant = valToWrite;<br />
m_comVariant.WriteToStream(m_pStream);
and read it like this:
m_comVariant.ReadFromStream(m_pStream);<br />
*pvalToRead = m_comVariant;
As a result in the read what I get is a "Bad varibale type" error
I also tried this with CComBSTR and got the same results
Any ideas?
Thanks a million for any help
Alberto Gattegno
Software Engineer
http://www.itgil.com
|
|
|
|