VB调用windowsAPI

1.读取文件数据

Private DeclareFunction ReadFile Lib "kernel32 " (ByVal hFile As Long,lpBuffer AsAny,ByVal nNumberOfBytesToRead As Long,lpNumberOfBytesRead As Long,ByVallpOverlapped As Any) As Long

2.取得系统时间

Private Declare SubGetSystemTime Lib "kernel32" (lpSystemTime As SYstemTIME)

3.取得特殊文件夹路径

Private DeclareFunction SHGetSpecialFolderLocation Lib "Shell32" (ByVal hwndOwner AsLong,ByVal nFolder As Integer,ppidl As Long) As Long

4.Private DeclareFunction SHGetPathFromIDList Lib "Shell32" Alias"SHGetPathFromIDListA" (ByVal pIdl As Long,ByVal szPath As String)As Long

5.取得windows目录

Private DeclareFunction GetwindowsDirectory Lib "kernel32" Alias"GetwindowsDirectoryA" (ByVal lpBuffer As String,ByVal nSize AsLong) As Long

6.取得系统目录

Private DeclareFunction GetSystemDirectory Lib "kernel32" Alias"GetSystemDirectoryA" (ByVal lpBuffer As String,ByVal nSize As Long)As Long

7.取得临时文件夹的路径

Private DeclareFunction GetTempPath Lib "kernel32" Alias "GetTempPathA"(ByVal nBufferLength As Long,ByVal lpBuffer As String) As Long

8.打开文件

Private DeclareFunction OpenFile Lib "kernel32" (ByVal lpFileName As String,lpReOpenBuff As OFSTRUCT,ByVal wStyle As Long) As Long

9.取得文件大小

Private DeclareFunction GetFileSizeEx Lib "kernel32" (ByVal hFile As Long,lpFileSize As Currency) As Boolean

10.关闭句柄

Private DeclareFunction CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

11.取得用户名

Private DeclareFunction GetUserName Lib "advapi32.dll" Alias"GetUserNameA" (ByVal lpBuffer As String,nSize As Long) As Long

12.取得时间返回long型

Private DeclareFunction timeGetTime Lib "winmm.dll" () As Long

13.取得驱动器类型

Private DeclareFunction GetDriveType Lib "kernel32" Alias "GetDriveTypeA"(ByVal nDrive As String) As Long

14.取得系统图标时使用

Private DeclareFunction ImageList_Draw Lib "comctl32.dll" (ByVal himl&,ByVali&,ByVal hDCDest&,ByVal x&,ByVal y&,ByVal flags&) AsLong

15.显示滚动条

Private DeclareFunction ShowScrollBar Lib "user32" (ByVal hwnd As Long,ByVal wBaras Long,ByVal bShow As Long) As Long

16.设置读取文件数据的Index

Private DeclareFunction SetFilePointer Lib "kernel32 " (ByVal hFile As Long,ByValldistancetoMove As Long,lpdistancetoMoveHigh As Long,ByVal dwMoveMethod AsLong) As Long

17.取得磁盘剩余空间

Private DeclareFunction GetdiskFreeSpace Lib "kernel32" Alias"GetdiskFreeSpaceA" (ByVal lpRootPathName As String,lpSectorsPerCluster As Long,lpBytesPerSector As Long,lpNumberOfFreeClustersAs Long,lpTtoalNumberOfClusters As Long) As Long

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...