Interviewer And Interviewee Guide

ASP Programming Interview Question:

Can I use the Win32 API from a .NET Framework program?

Submitted by: Administrator
Yes. Using platform invoke, .NET Framework programs can access native code libraries by means of static DLL entry points.
Here is an example of C# calling the Win32 Message Box function:
using System;
using System.Runtime.InteropServices;
class MainApp
{
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);
public static void Main()
{
MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 );
}
}
Submitted by: Administrator

Read Online ASP Programming Job Interview Questions And Answers
Copyright 2007-2025 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.

Interview Questions Answers .ORG