新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
VB.NET使用API技巧講解
VB.NET作為一個(gè)功能強(qiáng)大的開發(fā)平臺(tái),給開發(fā)人員帶來了不少的好處。我們今天為大家介紹的是VB.NET使用API的相關(guān)技巧,希望能給大家?guī)硪恍椭岣叽蠹业木帉懶?,方便大家了解這門語言的應(yīng)用方式。

可能說VB.NET是一個(gè)令人恨又令愛的編程軟件,新版的.NET不像VB6那樣多的支持API調(diào)用,好不容易在MSDN中找到的VB.NET使用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
這是調(diào)用Kernel中的MoveFile函數(shù),在DllImport中必須聲明要調(diào)用的函數(shù)庫明,如Kernel32,User32,GDI32等,EntryPoint為要調(diào)用函數(shù)名.
下面是調(diào)用ShowWindow函數(shù)的實(shí)例:
- SetLastError:=True, CharSet
CharSet:=CharSet.Unicode, _- ExactSpelling:=True, _
- CallingConventionCalling
Convention:=Calling
Convention.StdCall)> _- Public Shared Function
ShowWindow(ByVal HWNE
As Integer,_- ByVal nCmdShow As Integer)
As Integer- End Function
順便說一句,在.NET中使用從前VB6中HWND屬性的方法是:
Me.Handle.ToInt32
以上就是對(duì)VB.NET使用API的詳細(xì)介紹。
網(wǎng)頁標(biāo)題:VB.NET使用API技巧講解
分享路徑:http://www.dlmjj.cn/article/dpooojs.html


咨詢
建站咨詢
