’-----ユーザフォーム----------- Private Declare Function EnumChildWindows Lib "USER32" (ByVal hWndParent As IntPtr, ByVal lpEnumFunc As IntPtr, ByVal lParam As Integer) As Integer
Public Function EnumChildProc(ByVal hWnd As IntPtr) As Integer
MsgBox(hWnd.ToString)
EnumChildProc = 1
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
分類:[.NET]
VB6だと以下のコードで動いたのですが、VB.NETだと
AddressOf EnumChildProc部分でエラーが出てしまいます。
EnumChildProcプロシージャーのポインタをどのように渡せばいいのでしょうか?
型はVB.NETにあったように変えているつもりなのですが。
’-----ユーザフォーム-----------
Private Declare Function EnumChildWindows Lib "USER32" (ByVal hWndParent As IntPtr, ByVal lpEnumFunc As IntPtr, ByVal lParam As Integer) As Integer
Public Function EnumChildProc(ByVal hWnd As IntPtr) As Integer
MsgBox(hWnd.ToString)
EnumChildProc = 1
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
EnumChildWindows(Me.Handle, AddressOf EnumChildProc←この部分, 0)
End Sub