码迷,mamicode.com
首页 > Web开发 > 详细

vb.net实现Vb中的Any变体类型

时间:2016-07-21 17:47:05      阅读:822      评论:0      收藏:0      [点我收藏+]

标签:

今天无意中发现可以替代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

 

vb.net实现Vb中的Any变体类型

标签:

原文地址:http://www.cnblogs.com/Ghsoft/p/5692255.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!