Solved

What does "Imports System.Runtime.InteropServices" mean

Posted on 2007-03-19
2
501 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Runtime Exceptions when trying to submit data 28 51
Error on link 14 46
.net and XML report from SCCM 5 20
Switching Visual Studio 2015 to normal debug display 3 24
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

10 Experts available now in Live!

Get 1:1 Help Now