Solved

What does "Imports System.Runtime.InteropServices" mean

Posted on 2007-03-19
2
496 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now