Solved

What does "Imports System.Runtime.InteropServices" mean

Posted on 2007-03-19
2
511 Views
Last Modified: 2010-04-14
I'm trying to use a snippet of code from a solution that I found here:
http://www.experts-exchange.com/Programming/Languages/.NET/Q_21739204.html
I’m not sure I understand what kind form this is.

The project only comes-up with two warnings:
Unused local variable: 'size'.

And:

Variable 'class' is passed by reference before it has been assigned a value. A null reference exception could result at runtime.

I will deal with those warning in another thread but what does this line mean:
Imports System.Runtime.InteropServices
0
Comment
Question by:Delta526
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
MrClyfar earned 500 total points
ID: 18752827
Hi there.

Basically, System.Runtime.InteropServices is used when you want to interact with the Windows API eg with declaring functions for API interactions:

 <DllImport("User32", False, CallingConvention.Cdecl, CharSet.Unicode)> _
  Public Shared Function SomeWinAPIFunction() As IntPtr

(note: don't use the above code copy-and-paste style since I just typed it off the top of my head - it could be incorrect!, but you get the idea.)

You also use this namespace if you want to do COM-based development with components written in, say, VB6 or VC++ 6 as en example.

There are many classes and interfaces to be found in this namespace which help a developer interact with COM components.

Jas.
0
 

Author Comment

by:Delta526
ID: 18753585
Thank you Jas,

Could this be one of the reasons the my findwindow API application does not work in VB.NET:
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_22454660.html
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question