Windows Apiの使用方法


2種類の方法が存在する。
1.Declare Functionで記述(VB6.0とほぼ同じ)
2.DLLImportで記述(実行するApiがstaticでないとダメらしい)


例)SendMessageAを呼び出す
1.Declare Functionで記述
   Private Declare Function SendMessageA Lib "User32.dll" ( _
          ByVal window As IntPtr, ByVal msg As Integer, _
          ByVal wParam As IntPtr, ByRef lParam As Rect) As Integer


2.DLLImportで記述
Imports System.Runtime.InteropServices

Public Class xxxx

   <DllImport("user32.dll")> _
   Private Shared Function SendMessageA(ByVal window As IntPtr, ByVal msg As Integer, _
          ByVal wParam As IntPtr, ByRef lParam As Rect) As Integer
   End Function




















.
最終更新:2008年07月18日 11:23