Unmanaged code in .net
VB.NET:
Imports System.Runtime.InteropServices
Public Class MessageBoxVB
Public Const UserReference As String = "user32.dll"
<DllImport(UserReference)> _
Private Shared Function MessageBox(ByVal hWnd As IntPtr, ByVal pText As String, ByVal pCaption As String, ByVal uType As Int32) As Int32
End Function
End Class
Public Class MessageBoxVB
Public Const UserReference As String = "user32.dll"
<DllImport(UserReference)> _
Private Shared Function MessageBox(ByVal hWnd As IntPtr, ByVal pText As String, ByVal pCaption As String, ByVal uType As Int32) As Int32
End Function
End Class
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace ComVisibleCS
{
class MessageBoxCS
{
public const String UserReference = "user32.dll";
[DllImport(UserReference, SetLastError = true)]
private static extern Int32 MessageBox(IntPtr hWnd, String pText, String pCaption, Int32 uType);
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace ComVisibleCS
{
class MessageBoxCS
{
public const String UserReference = "user32.dll";
[DllImport(UserReference, SetLastError = true)]
private static extern Int32 MessageBox(IntPtr hWnd, String pText, String pCaption, Int32 uType);
}
}