1

We are trying to develop a Plugin for an application, and have unfortunately not received any actual instruction on what to use, how to use, and what is available for the development API. So far our direction has been "Can be developed in VB and C#", and "Watch these videos". However, the videos are not so much on how to develop Plugins, just what you can do with the API.

One of the apparently essential parts of the development is the use of the VB COM Class (primarily due to the "free" GUIDs generated in the class). This would be fine, apart from the fact that my VB knowledge is outdated by roughly a decade. My C# knowledge however, while still incomplete, is far more up-to-date.

So; is there a COM counterpart in C#, or do I need to manage this another way?

EDIT: To clarify, the COM Class is used to compile the project as a .dll (obviously), so it can be loaded into the application as a plugin. The reference material I have reviewed simply states that this can be created, and there is no existing COM Class that needs to be imported in any way. For reference; the application is a DMS called "Adept".

3
  • wow, VBA/COM to rescue C#/.net with an interoperability mechanism? I'm sure I'm missing something, or there must be some non-stated reasons for this requirement. Commented Apr 20, 2017 at 0:57
  • @A.S.H I'm sure I am too. Like I said, the reference material on this project is lacking. Commented Apr 20, 2017 at 0:59
  • However interoperability between .net languages and COM works fine to good extent. Commented Apr 20, 2017 at 1:01

1 Answer 1

2

COM isn't strictly language-specific as much as it is framework-specific. So the simple answer is that you can do COM in C# as much as you can do it in VB.

I won't copy-paste an entire MSDN article, but here is a quick example: https://msdn.microsoft.com/en-us/library/c3fd4a20.aspx

However, I am slightly confused by your question - are you being asked to create a COM class, or use an existing one?

The article above describes making a COM class. If you need to use an existing COM class library (e.g. an existing .dll), then it is often as simple as adding a Reference to the .dll in your project.

The question is tagged 'vba' but the question mentions VB? The two are similar in many ways, but also at times very different.

Instructions for adding a Reference in Visual Studio are at https://msdn.microsoft.com/en-us/library/wkze6zky.aspx.

If you are developing VBA, as opposed to VB, if you could let us know what you're developing in (e.g. Excel?), we might be able to offer more advice.

Sign up to request clarification or add additional context in comments.

9 Comments

Thanks for your answer! This project is completely new, so the instruction is to create a new COM Class. As for the Application, it's a DMS called "Adept".
It's possible I might have mis-tagged the post, too. Now I think about it, it is more likely to be vb.net, but I'm still not 100%
Seems like you have a lot of things to establish before you even start. First pick a language (VB.net or C# - either can be used but you'll generally find more examples in C#). Now write some code and build a COM compliant DLL. Here's an example: msdn.microsoft.com/en-us/library/c3fd4a20.aspx. Now you have to work out how your application uses that COM component. Lastly you need to consider if it's worth your time to invest in a product that only supports an ancient API framework
@MattStyles my understanding is that it needs to be COM because the application being "plugged-in" is COM. Much like the latest Microsoft Office or Visual Studio. COM is far from dead.
@MattStyles Wow. Then again; how many people do you know that still own 3.5" FDDs? If you are the only one who can access it, I'd say that's pretty secure!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.