'関数ポインタ Dim pMsgBox As *Function(hWnd As HWND, _ lpText As BytePtr, lpCaption As BytePtr, _ uType As DWord) As Long Dim hInst As HINSTANCE hInst = LoadLibrary("user32.dll") If hInst = 0 Then MessageBox(0,"ロードエラー" , "ERROR!" , MB_OK) ExitProcess(0) End If pMsgBox = GetProcAddress(hInst , "MessageBoxA") If pMsgBox = 0 Then MessageBox(0,"ロードエラー" , "ERROR!" , MB_OK) ExitProcess(0) End If pMsgBox(0,"test" , "test" , MB_OK) FreeLibrary(hInst)最初の行で、関数ポインタを宣言しています。
(補足)
MessageBox関数は実はMessageBoxAとMessageBoxWの2つがあります。
MessageBox関数に限らず、文字列が絡む関数はAとWの2つがあります。
関数内部で文字列の扱いが異なり、AはANSIにWはunicodeで扱います。
ABは文字列の扱いがunicodeではないので、Wのつく関数は正常な動作はしません。