今天无意中发现可以替代VB中的Any 在API声明中可以使用<MarshalAs(UnmanagedType.AsAny)>
VB中声明的API
1 Declare Function SendMessage& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
在vb.net可以这样玩
1 Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, <MarshalAs(UnmanagedType.AsAny)> lParam As Object) As Int32