⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rapi.vb

📁 Programming the .NET Compact Framework with vb 源代码
💻 VB
📖 第 1 页 / 共 3 页
字号:
         BATTERY_FLAG_NO_BATTERY = &H80
         BATTERY_FLAG_UNKNOWN = &HFF
      End Enum

      Public Const BATTERY_PERCENTAGE_UNKNOWN As Integer = &HFF
      Public Const BATTERY_LIFE_UNKNOWN As Integer = &HFFFFFFFF

      Public Enum REGDISP
         REG_CREATED_NEW_KEY = &H1
         REG_OPENED_EXISTING_KEY = &H2
      End Enum

      <StructLayout(LayoutKind.Sequential, Pack:=4)> _
         Public Structure SYSTEM_POWER_STATUS_EX
         Dim ACLineStatus As Byte
         Dim BatteryFlag As Byte
         Dim BatteryLifePercent As Byte
         Dim Reserved1 As Byte
         Dim BatteryLifeTime As Integer
         Dim BatteryFullLifeTime As Integer
         Dim Reserved2 As Byte
         Dim BackupBatteryFlag As Byte
         Dim BackupBatteryLifePercent As Byte
         Dim Reserved3 As Byte
         Dim BackupBatteryLifeTime As Integer
         Dim BackupBatteryFullLifeTime As Integer
         End Structure


      Public Const CERAPI_E_ALREADYINITIALIZED As Integer = &H80041001

      <StructLayout(LayoutKind.Sequential, Pack:=4)> _
      Public Structure RAPIINIT
         Public cbSize As Integer
         Public heRapiInit As IntPtr
         Public hrRapiInit As Integer
      End Structure


      <StructLayout(LayoutKind.Sequential, Pack:=4)> _
      Public Structure SYSTEM_INFO
         <StructLayout(LayoutKind.Explicit)> _
         Public Structure _SYSTEM_INFO_ARCH
            <FieldOffset(0)> Dim dwOemId As Integer
            <FieldOffset(0)> Dim wProcessorArchitecture As Short
            <FieldOffset(2)> Dim wReserved As Short
         End Structure

         Dim dwPageSize As Integer
         Dim lpMinimumApplicationAddress() As Byte
         Dim lpMaximumApplicationAddress() As Byte
         Dim dwActiveProcessorMask As Integer
         Dim dwNumberOfProcessors As Integer
         Dim dwProcessorType As Integer
         Dim dwAllocationGranularity As Integer
         Dim wProcessorLevel As Short
         Dim wProcessorRevision As Short
      End Structure


      <StructLayout(LayoutKind.Sequential, Pack:=4)> _
         Public Structure PROCESS_INFORMATION
         Public hProcess As IntPtr
         Public hThread As IntPtr
         Public dwProcessId As Integer
         Public dwThreadId As Integer
         End Structure


      <StructLayout(LayoutKind.Sequential, Pack:=4)> _
         Public Structure MEMORYSTATUS
         Dim dwLength As Integer
         Dim dwMemoryLoad As Integer
         Dim dwTotalPhys As Integer
         Dim dwAvailPhys As Integer
         Dim dwTotalPageFile As Integer
         Dim dwAvailPageFile As Integer
         Dim dwTotalVirtual As Integer
         Dim dwAvailVirtual As Integer
         End Structure

      ' From WINBASE.H -- for CeCreateFile
      Public Enum ACCESS
         READ = &H80000000
         WRITE = &H40000000
      End Enum

      ' From WINBASE.H -- for CeCreateFile
      Public Enum SHARE
         READ = &H1
         WRITE = &H2
      End Enum

      ' From WINBASE.H -- for CeCreateFile
      Public Enum ACTION

         CREATE_NEW = 1
         CREATE_ALWAYS = 2
         OPEN_EXISTING = 3
         OPEN_ALWAYS = 4
         TRUNCATE_EXISTING = 5
      End Enum

      ' From WINBASE.H -- for CeCreateFile
      Public Enum FILEFLAGATT : uint
         ATTRIBUTE_READONLY = &H1
         ATTRIBUTE_HIDDEN = &H2
         ATTRIBUTE_SYSTEM = &H4
         ATTRIBUTE_DIRECTORY = &H10
         ATTRIBUTE_ARCHIVE = &H20
         ATTRIBUTE_INROM = &H40
         ATTRIBUTE_ENCRYPTED = &H40
         ATTRIBUTE_NORMAL = &H80
         ATTRIBUTE_TEMPORARY = &H100
         ATTRIBUTE_SPARSE_FILE = &H200
         ATTRIBUTE_REPARSE_POINT = &H400
         ATTRIBUTE_COMPRESSED = &H800
         ATTRIBUTE_OFFLINE = &H1000
         ATTRIBUTE_ROMSTATICREF = &H1000
         ATTRIBUTE_NOT_CONTENT_INDEXED = &H2000
         ATTRIBUTE_ROMMODULE = &H2000
         FLAG_WRITE_THROUGH = &H80000000
         FLAG_OVERLAPPED = &H40000000
         FLAG_NO_BUFFERING = &H20000000
         FLAG_RANDOM_ACCESS = &H10000000
         FLAG_SEQUENTIAL_SCAN = &H8000000
         FLAG_DELETE_ON_CLOSE = &H4000000
         FLAG_BACKUP_SEMANTICS = &H2000000
         FLAG_POSIX_SEMANTICS = &H1000000
      End Enum

' Wizard here
' Generated by PInvoke Wizard (v 1.0) from The Paul Yao Company http://www.paulyao.com 

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeCheckPassword( _
         ByVal lpszPassword As String _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeCloseHandle( _
         ByVal hObject As IntPtr _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeCopyFile( _
         ByVal lpExistingFileName As String _
         , ByVal lpNewFileName As String _
         , ByVal bFailIfExists As Integer _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeCreateDatabase( _
         ByVal lpszName As String _
         , ByVal dwDbaseType As Integer _
         , ByVal wNumSortOrder As Short _
         , ByRef rgSortSpecs As SORTORDERSPEC _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeCreateDatabaseEx( _
         ByRef pceguid As System.Guid _
         , ByRef lpCEDBInfo As CEDBASEINFO _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeCreateDirectory( _
         ByVal lpPathName As String _
         , ByVal Reserved As Integer _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeCreateFile( _
         ByVal lpFileName As String _
         , ByVal dwDesiredAccess As ACCESS _
         , ByVal dwShareMode As SHARE _
         , ByVal Res1 As Integer _
         , ByVal dwCreationDisposition As ACTION _
         , ByVal dwFlagsAndAttributes As FILEFLAGATT _
         , ByVal Res2 As Integer _
         ) As IntPtr
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeCreateProcess( _
         ByVal lpApplicationName As String _
         , ByVal lpCommandLine As String _
         , ByVal Res1 As Integer _
         , ByVal Res2 As Integer _
         , ByVal Res3 As Integer _
         , ByVal dwCreationFlags As Integer _
         , ByVal Res4 As Integer _
         , ByVal Res5 As Integer _
         , ByVal Res6 As Integer _
         , ByRef lpProcessInformation As PROCESS_INFORMATION _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeCreateProcess( _
         ByVal lpApplicationName As String _
         , ByVal Zero As Integer _
         , ByVal Res1 As Integer _
         , ByVal Res2 As Integer _
         , ByVal Res3 As Integer _
         , ByVal dwCreationFlags As Integer _
         , ByVal Res4 As Integer _
         , ByVal Res5 As Integer _
         , ByVal Res6 As Integer _
         , ByRef lpProcessInformation As PROCESS_INFORMATION _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeDeleteDatabase( _
         ByVal oidDbase As Integer _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeDeleteDatabaseEx( _
         ByRef pguid As System.Guid _
         , ByVal oid As Integer _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeDeleteFile( _
         ByVal lpFileName As String _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeDeleteRecord( _
         ByVal hDatabase As IntPtr _
         , ByVal oidRecord As Integer _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeEnumDBVolumes( _
         ByRef pceguid As System.Guid _
         , ByVal lpBuf As String _
         , ByVal dwNumChars As Integer _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeFindAllDatabases( _
         ByVal dwDbaseType As Integer _
         , ByVal wFlags As FAD _
         , ByRef cFindData As Short _
         , ByRef ppFindData As IntPtr _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeFindAllFiles( _
         ByVal szPath As String _
         , ByVal dwFlags As FAF _
         , ByRef lpdwFoundCount As Integer _
         , ByRef ppFindDataArray As IntPtr _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeFindClose( _
         ByVal hFindFile As IntPtr _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeFindFirstDatabase( _
         ByVal dwDbaseType As Integer _
         ) As IntPtr
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeFindFirstDatabaseEx( _
         ByRef pceguid As System.Guid _
         , ByVal dwDbaseType As Integer _
         ) As IntPtr
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeFindFirstFile( _
         ByVal lpFileName As String _
         , ByRef lpFindFileData As CE_FIND_DATA _
         ) As IntPtr
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeFindNextDatabase( _
         ByVal hEnum As IntPtr _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeFindNextDatabaseEx( _
         ByVal hEnum As IntPtr _
         , ByRef pceguid As System.Guid _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeFindNextFile( _
         ByVal hFindFile As IntPtr _
         , ByRef lpFindFileData As CE_FIND_DATA _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetClassName( _
         ByVal hWnd As IntPtr _
         , ByVal lpClassName As String _
         , ByVal nMaxCount As Integer _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetDesktopDeviceCaps( _
         ByVal nIndex As Integer _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetFileAttributes( _
         ByVal lpFileName As String _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetFileSize( _
         ByVal hFile As IntPtr _
         , ByRef lpFileSizeHigh As Integer _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetFileTime( _
         ByVal hFile As IntPtr _
         , ByRef lpCreationTime As FILETIME _
         , ByRef lpLastAccessTime As FILETIME _
         , ByRef lpLastWriteTime As FILETIME _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetLastError( _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetSpecialFolderPath( _
         ByVal nFolder As Integer _
         , ByVal nBufferLength As Integer _
         , ByVal lpBuffer As String _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetStoreInformation( _
         ByRef lpsi As STORE_INFORMATION _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Sub CeGetSystemInfo( _
         ByRef lpSystemInfo As SYSTEM_INFO _
         )
      End Sub

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetSystemPowerStatusEx( _
         ByRef pstatus As SYSTEM_POWER_STATUS_EX _
         , ByVal fUpdate As Integer _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetTempPath( _
         ByVal nBufferLength As Integer _
         , ByVal lpBuffer As String _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetVersionEx( _
         ByRef lpVersionInformation As CEOSVERSIONINFO _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetWindow( _
         ByVal hWnd As IntPtr _
         , ByVal uCmd As Integer _
         ) As IntPtr
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetWindowLong( _
         ByVal hWnd As IntPtr _
         , ByVal nIndex As Integer _
         ) As Integer
      End Function

      <DllImport(DllName, CharSet:=CharSet.Unicode)> _
      Public Shared Function CeGetWindowText( _
         ByVal hWnd As IntPtr _
         , ByVal lpString As String _
         , ByVal nMaxCount As Integer _
         ) As Integer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -