Blog / 阅读

在.NET中使用API的方法

by admin on 2014-04-23 13:34:08 in ,



可能说VB.NET是一个令人恨又令爱的编程软件,新版的.NET不像VB6那样多的支持API调用,好不容易在MSDN中找到的使用API的方法,代码如下:
[Visual Basic] 
SetLastError := True, CharSet := CharSet.Unicode, _
ExactSpelling := True, _
CallingConvention := CallingConvention.StdCall)> _
Public Shared Function MoveFile(src As String, dst As String) As Boolean
' Leave function empty - DLLImport attribute forces calls to MoveFile to
' be forwarded to MoveFileW in KERNEL32.DLL
End Function
这是调用Kernel中的MoveFile函数,在DllImport中必须声明要调用的函数库明,如Kernel32,User32,GDI32等,EntryPoint为要调用函数名.
下面是调用ShowWindow函数的实例:
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function ShowWindow(ByVal HWNE As Integer,_
ByVal nCmdShow As Integer) As Integer


End Function
顺便说一句,在.NET中使用从前VB6中HWND属性的方法是:
Me.Handle.ToInt32 


写评论

相关文章

上一篇:Java 实现视频转FLV,支持完成进度百分比

下一篇:DES加密算法详解- -

评论

写评论

* 必填.

分享

栏目

赞助商


热门文章

Tag 云