Solved

What does "Imports System.Runtime.InteropServices" mean

Posted on 2007-03-19
2
505 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
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 New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Help 27 57
Store results in vb.net 3 24
C# Gridview 1 46
Returning a value from a class function to a partial view in MVC5 7 28
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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