|
Hello scchan1984,
You would definitely need COM interop for a C++ COM application to connect with a C# object. The normal scenario in which this is achieved involves C# components housed in libraries.
However, the catch is that your C# object is contained inside a C# application (.exe). One way you can possibly achieve interop in this case would be through .NET Remoting. To do this, you would need to make your C# class derive from MarshalByRefObject.
It would also help if you could define an interface for the methods and properties that are to be exposed from your C# class to the C++ COM client.
Your COM client would then need to connect with your C# class (via Remoting) by using CLR hosting. I'll see if I can come up with some example code that can achieve all this.
Regards,
Bio.
|
|
|
|
|
Hello scchan1984,
I managed to develope and run a sample C++ app that creates a C# object (in a C# exe app) as a COM object. .NET Remoting can definitely do the job.
However, I must indicate that the development process is quite involved. If you are interested in my sample app, pls email me :
bio_lim_2004@yahoo.com
Best Regards,
Bio.
|
|
|
|
|
Dear engineer,
I don't know how to connect modem(sms gateway engine)by using visual basic,please help me.
Is there anyone have source sms gateway for CDMA modem which is developed by using visual basic.I need it right away.Please help me,thankyou...
|
|
|
|
|
Hi,
sorry if this has been asked before, but i read the two articles on COM Addins for Outlook 2000/2003:
http://www.codeproject.com/com/outlookaddin.asp[^]
http://www.codeproject.com/atl/outlook2k3addin.asp[^]
and have to implement an Addin for Outlook 2003.
Seemingly, i have not been able to create the Addin properly, as i experienced the following problem:
When it comes to importing the Office & Outlook typelibraries i face the problem of not knowing which DLLs are appropriate.
You know, the articles use Outlook 2000 DLLs, even the one on Outlook 2003...
<br />
#import "C:\Program Files\Microsoft Office\Office\mso9.dll" \<br />
rename_namespace("Office") named_guids <br />
using namespace Office;<br />
<br />
#import "C:\Program Files\Microsoft Office\Office\MSOUTL9.olb" <br />
rename_namespace("Outlook"), raw_interfaces_only, named_guids <br />
using namespace Outlook;<br />
I manage to find the second file, the appropriate *.olb file, but not the also needed MSOXXX.dll file of my Office installation, as the dll is renamed in Office 2003.
I tried several DLLs in the directory, but none has worked as i get a failure when i build the project (in MS Visual C++ 6.0).
Any ideas?
Regards,
Harry
|
|
|
|
|
Hi,
I am trying to a COM DLL with multiple objects but I only want to expose one interface to the user.
I would like to achieve something similar to the ADODC object in VB. User can only declare a new instant of the ADODC but not the Recordset object in it. That is "Dim Ado as ADODC" is ok but "Dim rs as Recordset" is not ok.
When user is writing a code in VB, I would like the user to be able to see the method and properties in the inner objects. Like the AddNew method or Field properties in recordset. That is
Dim MyObj as MyProject--------------Dim ADO as ADODC
MyObj = new MyProject---------------ADO = new ADO
MyObj.Inner.InnerMethod/Prop--------------ADO.Recordset.Addnew
While searching, I have come across terms like containment and Aggregation. I think containment is closer to what I am looking for but seems to be missing some finer details. From what I see Recordset "seems" to be a property field in ADODC.
Am I heading in the right direction? Can someone help me with my "missing links" please....
|
|
|
|
|
Just implement the COM classes as you normally would, but without registering them. It requires you however to internally create the COM objects by other means than CoCreateInstance, but that's no biggie if you are using ATL. CComObject<T> can help you out there. You can new the objects as well, but IIRC, there are some obscure pitfalls with that method.
--
An eye for an eye will only make the world blind.
|
|
|
|
|
Hi,
Thanks for replying. I can see that you are pretty active in this topic.
I am currently doing COM using ATL. So I may have problem implementing the COM class without registering them but that should not be too big a problem to solve.
I picked up COM by using ATL directly, so I keep having this feeling that my fundamental is wrong and I am really struggling to understanding any code in genertated code at all.
Do you know of any means where I can have a good read up on the internet. I know that the book Essential COM is highly recommended but before I get that I would like to read up more.
Thanks again.
Truth is not always popular, but it is always right.
|
|
|
|
|
Sorry, I don't have any handy internet references available. I have not solved your problem before either. Well, I did it the lazy way by not including the coclasses in the IDL file. Had I not been on vacation right now, I could've experimented on your behalf to find a smart solution, because it is not unlikely that I will face this problem myself.
One really bad "hack" I can think of right now, is to make the rgs-script associated with your COM class, an empty script. That should ensure that it is not registered at all. But please make sure that you use the CComObject<> template to instantiate the objects, otherwise the COM module's lock count will not be incremented (IIRC, that's the problem with just new -ing the objects). As I have not tried this hack at all, I can't say for certain that it will work. It could be the case that the rgs script parser doesn't allow empty script, in which case all you have to do is add some "dummy script" in your rgs file. Your mileage may vary.
Good music: In my rosary[^]
|
|
|
|
|
Oh yeah.. in case you have not used the CComObject template, this is the way you use it:
CComObject<CYourClass>* pObj;
HRESULT hr = CComObject<CYourClass>::CreateInstance(&pObj);
pObj->AddRef();
CComObject will however stabilize the refcount during the construction phase (temporarily incrementing it). I think. (It should!)
Good music: In my rosary[^]
|
|
|
|
|
Thanks for the quick reply and thanks for taking the trouble to reply even when you are on vacation.
One last question, how do you think the VB recordset example I use is implemented?
Currently what I feel is that recordset is a get_property under ADODC and when this is call the pointer to the recordset object is in my COM is passed returned.
But I found a project in code project that use a method to implement this, It does return the pointer of the inner object.
Please dun take too much of your time on this, just give me your nbest guess. Thanks and enjoy your holiday.
|
|
|
|
|
Hi
I am trying to use the EM_GETLINE message to get the text of a particular line but i am not able to send the last parameter i.e the lpram..for the SendMessage function... anyone plz let me know how to do this... i am doin in the following way
char[] buffer = new char[255];
buffer[0] = (char)255;
Message msg = Message.Create(this.Handle, EM_GETLINE, (IntPtr)Index, (IntPtr)buffer[0]);
base.DefWndProc(ref msg);
return msg.Result.ToInt32();
but it gives me a error like.. "Attempted to read write protected memory. This is often indication that other memory is corrupt." F1! F1!
cheers
Chettu
|
|
|
|
|
Hi Every one
Can any body guide me that how one can set Launch Permissions Programmatically for any DCOM Component through vc++ or VB.
actually i want to give specific groups lauch permission to one of my DCOM
component while installation of application.
Thanks and Regards.
Mohammad Kamran
|
|
|
|
|
Hello
I have a ActiveX component created in VB6, (where it works fine!). But when I implement the ActiveX component into VS.NET web application, on the client side, the methods(in the Active X) dont function as they should. Is there anything I have to do to my activeX before I implement it into VS.NET??
Spaz
|
|
|
|
|
|
Hi All,
I am facing one problem regarding SOAP. Below mentioned is the scenario.
I m writing a soap client. I want to access the services of COM. The COM Method what I am using is not returning any thing other than HRESULT as return value. Is there any way to get the HRESULT value in Soap Response?
Ashish
Regards,
Ashish Gupta | Systems Engineer | S I E M E N S Information Systems Ltd
Telephone: (080) 28091092
Mobile : (0) 94483 82115
www.siemens.co.in
|
|
|
|
|
Hello
I wanted to know how to register an ActiveX.EXE file (writen in VB6).
as long as regsvr32.exe only registers ActiveX.dll and .OCX files.
I tried running the file, but it didn't help while I had a previously registered activex exe (which the same name) in some other location. when I try to create an object from the activex exe, the object returned from CreateObject is the object from the first activex..
How can I create an object from the second activex exe?
(THE FIRST ACTIVEX.EXE WAS REGISTERED BY VB6 WHILE I COMPILED IT)
Also I'd be glad if you tell me how to unregister the activex exe file?
Thanks in advance.
|
|
|
|
|
Hello,
For registering Activex exe,you have to register separately.Regsvr32 or compilrer unable to register Active X exe. If you want to know more plz contact me .....;)
sanjayrvyas
|
|
|
|
|
Hello
I'd be glad if you here describe how should I register the activex exe...
Please tell the details while I have never had any idea of how to register an activex exe.
(Should I generate the ClassID and add it to registery? if yes, how?)
Thanks in advance
|
|
|
|
|
I finally could find the answer:
To register the activex exe:
ActvieX.EXE /regserver
and to unregister it:
ActiveX.EXE /unregserver
|
|
|
|
|
I'm having a problem understanding how to register Windows Shell extensions, specifically for PropertySheet extensions and their handlers.
I am not too happy with the way it's done here -
Property Sheet Shell Extension in C#
Also, can anyone direct me to an example in VB.NET for the same sort of thing that's described in that article? That is, a property sheet extension example.
Thanks for any help - Ian Thomas
|
|
|
|
|
I'm working on a COM control that's used in several places. We use ATL to work with it, in VC++. We use the COM control as an embedded control in HMTL, and also in a "standalone" application. So here's the problem. We want to listen for the arrow keys to scroll over a document, and there's an OnKeyDown handler defined, etc. This function gets called just fine when the control is in "standalone" application. I can use the debugged to see it being called when the user presses a key, and the scrolling happens. However, when we're running embedded in HTML... the OnKeyDown function never gets called! However, pressing the arrow keys will scroll the HTML page in IE.
Does IE not pass the arrow keys messages to COM controls, or what? Is there something special I need to do make IE pass the messages on?
|
|
|
|
|
As an update, I've discovered that the OnKeyUp event does arrive, but not the OnKeyDown event. WTF mate?
vir·tu·al re·al·i·ty
n. Abbr. VR
A computer simulation of a real or imaginary universe in which Microsoft APIs are thoroughly documented and behave in an entirely logical manner.
|
|
|
|
|
|
Is there any method to interact with IE (press buttons, fill forms) from outside Win32 Application?
Please help.
(any links or samles)
Thank you.
|
|
|
|
|
Hello,
I´ve created a COM Event client (using IConnectionPoint... etc. interface). It works fine if there is not too much load (i.e. events fired from the server); because the client needs some time to process the event.
However, I´m not sure who´s responsible for the "Event Queue"? What happens if there are more events comming from the server which the client can´t process within the same time? Has the server to queue the event`s? Or has the client to take care of all events and that events get lost if the client "is not ready"?
I read a lot of (good) articles concerning COM Events. But I can´t find any detailed information about this topic.
Can anyone help me with this question?
Thank you in advance,
Stefan
|
|
|
|