1

Sorry if my question is so primitive. I'm a beginner in C# and I should use a COM Interface (.DLL) and implement it in my code. It's about a time attendant clock and I need to retrieve data out of its database. It uses some classes and my goal is to retrieve "Messages" out of it. The only documentation I have is this:

The “InsightClass” class contains the following:

Methods

...

o GetReviewMessages

o InsightClass

o Login

o Logout

o ReviewMessage

Review Events:

The ReviewMessage event will fire every time a new Review event is received in Insight.

Retrieving data: Using the “StartLiveReview” method will begin the receipt of new review messages from the Insight server, conversely, this process is ended with the “EndLiveReview” method. One can also retrieve a discrete set of Review data by means of the “GetReviewMessages” method. One specifies the desired date/time boundaries within which data is to be retrieved. Insight review:

The above methods will result in a collection of “InsightReview” objects. Using the “InsightReviewMessagesClass” class, one can obtain the current count of “InsightReview” objects and access individual “InsightReview” objects by means of the “Item” property. An “InsightReview” object is effectively a Review message. It has the following properties:

o ...

o Message

Could you please let me know how can I relate “GetReviewMessages” method to “InsightReview” objects within “InsightReviewMessagesClass” class in my code?

Thanks a heap in advance...

2
  • Why did you tag your question with VB.NET in addition to C#? Also, if you're just learning C# I'm not sure COM is the first thing you want to tackle....my impression is that it can be rather complex (but I've done very little with COM so I could be wrong). Commented Aug 9, 2013 at 4:30
  • Thanks for your comment Tim. The reason I added vb.net as a tag is that the .DLL could be used within MS dot net framewrok. I'm developing for a long time with vb and not too much familiar with classes and OOP programming unfortunately bot not novice completely... Commented Aug 9, 2013 at 4:53

2 Answers 2

3

Basically you need to add a reference the COM DLL from inside Visual Studio and it will create a new .NET DLL that wraps around the COM DLL and allows you to use the COM DLL from C#. In short you do the following steps:

  1. Select Project > Add Reference
  2. Select the COM tab in the Add Reference dialog box.
  3. Scroll down the list of COM components until you find your COM DLL/library, select it and click OK.

Essentially the above steps get Visual Studio to run Tlbimp for you to generate a .NET DLL that is a wrapper around the COM object.

A good tutorial is here (the first part with all the code is just explanatory to help you understand what is happening, don't be overwhelmed, jump to the Example 1: Using TlbImp section for actual steps you need to follow).

If you still have problems give us more information such as what steps you are able to take successfully and maybe a paste of the code from the "Code Definition Window" for the COM Class that you reference which should show the methods you refer to above.

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

3 Comments

@Mike: My pleasure. COM+.NET is a beast at first. Let me know if you have any more questions. If this answer does indeed answer your question please mark this answer as accepted: meta.stackexchange.com/questions/5234/…
Thanks again ActiveScott. To be honest, I don't know how to use “InsightReviewMessagesClass” class. This is what I've done so far: pClass = new InsightInterface.InsightClass(); InitializeComponent(); private void button1_Click_1(object sender, EventArgs e) { pClass.Login("something", "something", "xx.xx.xx.xxx", xxx); DateTime DateFrom = new DateTime(2013, 8, 8); DateTime DateTo = new DateTime(2013, 8, 8); if (pClass.IsLoggedOn) MessageBox.Show("Logged in successfully"); } I know that I should use something like pClass.GetReviewMessages(DateTo, DateTo);
@Mike Yeah, we'll need more info at least to help you with InsightReviewMessagesClass too. Obviously it is a proprietary class of some kind and we have no knowledge of it. However, if you need help with it specifically give us more details such as the error you're getting or what you've tried and what the actual vs expected behavior is. And again, as I mentioned in my answer above a screenshot or a copy/paste of the code from the CodeDefinition window of the class and it's methods might be helpful.
0

There must be one event handler in that which inform you when data InsightReview arrived

so subscribe that event from class with appropriate function in your wrapper class.

1 Comment

Thanks guys, I really appreciate. Yes, there are two events there: o ConnectionStateChange o ReviewMessage I believe you're talking about ReviewMessage event. The ReviewMessage event will fire every time a new Review event is received in Insight. I'm not sure about rules here but I can send the complete pdf file if you could help me with this as I really need to solve this problem. Thanks a lot again.

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.