Changeset 258 for Include/Classes/System
- Timestamp:
- May 21, 2007, 1:03:21 AM (18 years ago)
- Location:
- Include/Classes/System
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Environment.ab
r237 r258 3 3 #require <api_psapi.sbp> 4 4 #require <Classes/System/OperatingSystem.ab> 5 6 Namespace System 7 8 Namespace Detail 9 TypeDef PFNGetProcessMemoryInfo = *Function(Process As HANDLE, ByRef mc As PROCESS_MEMORY_COUNTERS, cb As DWord) As BOOL 10 End Namespace 5 11 6 12 Class Environment … … 45 51 End Function 46 52 47 ' MachineName 53 Static Function MachineName() As String 54 If Object.ReferenceEquals(machineName, Nothing) Then 55 Dim buf[MAX_COMPUTERNAME_LENGTH] As TCHAR 56 Dim len = (MAX_COMPUTERNAME_LENGTH + 1) As DWord 57 GetComputerName(buf, len) 58 machineName = New String(buf, len As Long) 59 End If 60 Return machineName 61 End Function 48 62 49 63 Static Function NewLine() As String … … 90 104 ' UserInteractive 91 105 92 ' UserName 106 Static Function UserName() As String 107 If Object.ReferenceEquals(userName, Nothing) Then 108 Dim buf[UNLEN] As TCHAR 109 Dim len = (UNLEN + 1) As DWord 110 GetUserName(buf, len) 111 userName = New String(buf, len As Long) 112 End If 113 Return userName 114 End Function 93 115 94 116 ' Version 95 117 118 Public 119 'NTでしか使用できない仕様 96 120 Static Function WorkingSet() As Int64 97 TypeDef PFNGetProcessMemoryInfo = *Function(Process As HANDLE, ByRef mc As PROCESS_MEMORY_COUNTERS, cb As DWord) As BOOL98 Dim pGetProcessMemoryInfo As PFNGetProcessMemoryInfo99 121 Dim hmodPSAPI = LoadLibrary("PSAPI.DLL") 100 122 If hmodPSAPI = 0 Then Return 0 101 pGetProcessMemoryInfo = GetProcAddress(hmodPSAPI, ToMBStr("GetProcessMemoryInfo")) AsPFNGetProcessMemoryInfo123 Dim pGetProcessMemoryInfo = GetProcAddress(hmodPSAPI, ToMBStr("GetProcessMemoryInfo")) As Detail.PFNGetProcessMemoryInfo 102 124 If pGetProcessMemoryInfo <> 0 Then 103 125 Dim mc As PROCESS_MEMORY_COUNTERS … … 136 158 ' GetEnvironmentVariables 137 159 160 Static Function GetFolderPath(f As Environment_SpecialFolder) As String 161 ' If ... Then 162 ' Throw New ArgumentException 163 ' End If 164 Dim x As Long 165 x = f 166 Return ActiveBasic.Windows.GetFolderPath(x) 167 End Function 168 138 169 ' GetLogicalDrives 139 170 … … 143 174 Static cmdLine = Nothing As String 144 175 Static exitCode = 0 As Long 176 Static machineName = Nothing As String 145 177 Static osVer = Nothing As OperatingSystem 146 178 Static processorCount = 0 As Long 147 179 Static sysDir = Nothing As String 180 Static userName = Nothing As String 148 181 End Class 182 183 Enum Environment_SpecialFolder 184 Desktop = CSIDL_DESKTOP 185 Programs = CSIDL_PROGRAMS 186 Personal = CSIDL_PERSONAL 187 MyDocuments = CSIDL_PERSONAL 188 Favorites = CSIDL_FAVORITES 189 Startup = CSIDL_STARTUP 190 Recent = CSIDL_RECENT 191 SendTo = CSIDL_SENDTO 192 StartMenu = CSIDL_STARTMENU 193 MyMusic = CSIDL_MYMUSIC 194 DesktopDirectory = CSIDL_DESKTOPDIRECTORY 195 MyComputer = CSIDL_DRIVES 196 Templates = CSIDL_TEMPLATES 197 ApplicationData = CSIDL_APPDATA '4.71 198 LocalApplicationData = CSIDL_LOCAL_APPDATA 199 InternetCache = CSIDL_INTERNET_CACHE 200 Cookies = CSIDL_COOKIES 201 History = CSIDL_HISTORY 202 CommonApplicationData = CSIDL_COMMON_APPDATA '5.0 203 System = CSIDL_SYSTEM 204 CommonProgramFiles = CSIDL_PROGRAM_FILES 205 ProgramFiles = CSIDL_PROGRAM_FILES 206 MyPictures = CSIDL_MYPICTURES 207 End Enum 208 209 210 End Namespace 'System -
Include/Classes/System/OperatingSystem.ab
r257 r258 6 6 #require <Classes/System/Version.ab> 7 7 8 Namespace System 9 8 10 Class OperatingSystem 9 11 ' Inherits ICloneable', ISerializable 10 12 Public 11 13 ' Constractor 12 Sub OperatingSystem(platform As PlatformID, version As System.Version)14 Sub OperatingSystem(platform As PlatformID, version As Version) 13 15 pf = platform 14 16 ver = version … … 18 20 Sub OperatingSystem(vi As OSVERSIONINFOA) 19 21 pf = vi.dwPlatformId As PlatformID 20 ver = New System.Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)22 ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber) 21 23 sp = New String(vi.szCSDVersion As PCSTR) 22 24 End Sub … … 24 26 Sub OperatingSystem(vi As OSVERSIONINFOW) 25 27 pf = vi.dwPlatformId As PlatformID 26 ver = New System.Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber)28 ver = New Version(vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber) 27 29 sp = New String(vi.szCSDVersion As PCSTR) 28 30 End Sub … … 33 35 End Function 34 36 35 Const Function Version() As System.Version37 Const Function Version() As Version 36 38 Return ver 37 39 End Function … … 71 73 Private 72 74 pf As PlatformID 73 ver As System.Version75 ver As Version 74 76 sp As String 75 77 End Class … … 83 85 End Enum 84 86 87 End Namespace 88 85 89 #endif '__SYSYTEM_OPERATINGSYSTEM_AB__ -
Include/Classes/System/Threading/WaitHandle.ab
r237 r258 3 3 #ifndef __SYSTEM_THREADING_WAITHANDLE_AB__ 4 4 #define __SYSTEM_THREADING_WAITHANDLE_AB__ 5 6 'Namespace System 7 'Namespace Threading 8 9 Namespace Detail 10 TypeDef PFNSignalObjectAndWait = *Function(hObjectToSignal As HANDLE, hObjectToWaitOn As HANDLE, dwMilliseconds As DWord, bAlertable As DWord) As DWord 11 End Namespace 5 12 6 13 Class WaitHandle … … 62 69 End Function 63 70 71 Public 64 72 Static Function SignalAndWait(ByRef toSignal As WaitHandle, ByRef toWaitOn As WaitHandle, millisecondsTimeout As Long, exitContext As BOOL) As BOOL 65 TypeDef PFNSignalObjectAndWait = *Function(hObjectToSignal As HANDLE, hObjectToWaitOn As HANDLE, dwMilliseconds As DWord, bAlertable As DWord) As DWord 66 Dim pSignalObjectAndWait = GetProcAddress(GetModuleHandle("Kernel32.dll"), "SignalObjectAndWait") As PFNSignalObjectAndWait 73 Dim pSignalObjectAndWait = GetProcAddress(GetModuleHandle("Kernel32.dll"), "SignalObjectAndWait") As Detail.PFNSignalObjectAndWait 67 74 If pSignalObjectAndWait = 0 Then 68 75 ' PlatformNotSupportedException … … 105 112 End Class 106 113 114 'End Namespace 'Threading 115 'End Namespace 'System 116 107 117 #endif '__SYSTEM_THREADING_WAITHANDLE_AB__
Note:
See TracChangeset
for help on using the changeset viewer.