• Welcome to Valhalla Legends Archive.
 

[C#] Plugin usable in COM?

Started by Chriso, July 04, 2007, 07:41 PM

Previous topic - Next topic

Chriso

Does anyone know if it is possible to create a C# plugin which can be used in Visual Basic 6.0 using CreateObject()? If so, point me to a documentation on it please...

Thanks.

MyndFyre

Quote from: Chriso on July 04, 2007, 07:41 PM
Does anyone know if it is possible to create a C# plugin which can be used in Visual Basic 6.0 using CreateObject()? If so, point me to a documentation on it please...

Thanks.

A plugin?  For what?

MBNCSUtil exposes objects to COM.  See: http://www.jinxbot.net/CodeBrowse/MBNCSUtil_1_3_1_8/Com/ICdKey.cs.aspx and http://www.jinxbot.net/CodeBrowse/MBNCSUtil_1_3_1_8/CdKey.cs.aspx.  Doing this, once you register the type library using regasm, you can use code along the lines of CreateObject("MBNCSUtil.CdKey").

QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Chriso


Chriso

One more question, how would I pass a COM object to .NET? I want to give the C# plugin access to the main form object in Visual Basic 6.0.

MyndFyre

Quote from: Chriso on July 05, 2007, 03:47 PM
One more question, how would I pass a COM object to .NET? I want to give the C# plugin access to the main form object in Visual Basic 6.0.
I'm not sure that's possible.  I don't know that a VB Form implements COM.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

l)ragon

Quote from: Chriso on July 05, 2007, 03:47 PM
One more question, how would I pass a COM object to .NET? I want to give the C# plugin access to the main form object in Visual Basic 6.0.
FrmMain.Hwnd?
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

Chriso

#6
If I pass the handle to the plugin, would C# be able to convert it to an object and use its attributes?

C# calls the object System.__ComObject when it is sent to the plugin from Visual Basic, therefore it knows it is a COM element, one would assume you could access its attributes or create an Interface (maybe?) which contains the attributes you want to use.

Chriso

Quote from: MyndFyre[vL] on July 05, 2007, 05:35 PM
Quote from: Chriso on July 05, 2007, 03:47 PM
One more question, how would I pass a COM object to .NET? I want to give the C# plugin access to the main form object in Visual Basic 6.0.
I'm not sure that's possible.  I don't know that a VB Form implements COM.
Would I be able to do it with a class declared in Visual Basic?

Imperceptus

Not to be rude, I am curious why you want to do this from your first post.
Quote from: Hazard on August 07, 2003, 03:15 PM
Highlight your entire code. Press the delete key. Start over again using Cuphead's CSB tutorial and work your way from their rather than raping code from downloaded sources meant purely for learning purposes. If this does not fix the problem, uninstall Visual Basic and get a new hobby. I suggest Cricket.

MyndFyre

Quote from: Chriso on July 07, 2007, 03:55 AM
Quote from: MyndFyre[vL] on July 05, 2007, 05:35 PM
Quote from: Chriso on July 05, 2007, 03:47 PM
One more question, how would I pass a COM object to .NET? I want to give the C# plugin access to the main form object in Visual Basic 6.0.
I'm not sure that's possible.  I don't know that a VB Form implements COM.
Would I be able to do it with a class declared in Visual Basic?
As long as the class was an ActiveX object.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Chriso

Quote from: MyndFyre[vL] on July 07, 2007, 03:45 PM
As long as the class was an ActiveX object.
Hmm I assume VB6 Classes are ActiveX...?

Barabajagal

...no... ActiveX Classes are ActiveX. When creating a new project, you have the option to make a Standard EXE, ActiveX EXE, ActiveX DLL, or ActiveX Control (plus a lot of others). I'm fairly certain you can make an ActiveX DLL (which is basically a standalone Class) and then use it like a COM Plugin... I don't know, I've never dealt with plugins.. but it's starting to interest me due to a project I'm thinking of writing.

Chriso

True, I was pretty hungover when I wrote that lol.

Yeah I was just trying to extend my application to use C# plugins, I have got it working with all other type declarations except object's.

Barabajagal

I don't think objects are interchangeable between languages... but I might be wrong.

MyndFyre

Quote from: Andy on July 07, 2007, 09:42 PM
I don't think objects are interchangeable between languages... but I might be wrong.
You are in fact, like I pointed out in my first reply to this thread.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.