Changeset 258
- Timestamp:
- May 21, 2007, 1:03:21 AM (18 years ago)
- Location:
- Include
- Files:
-
- 10 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__ -
Include/api_shell.sbp
r170 r258 374 374 375 375 ' ShlObj.h 376 377 '要IE4 376 378 Declare Function SHGetSpecialFolderPath Lib "shell32" Alias _FuncName_SHGetSpecialFolderPath (hwndOwner As HWND, lpszPath As LPTSTR, nFolder As Long, fCreate As BOOL) As BOOL 377 379 … … 379 381 Declare Function SHGetInstanceExplorer Lib "shell32" (ByRef ppunk As *IUnknown) As HRESULT 380 382 381 Const CSIDL_PERSONAL = 5 382 Const CSIDL_FAVORITIES = 6 383 'shlobj.h 384 Declare Function SHGetSpecialFolderLocation Lib "shell32" (hwndOwner As HWND, nFolder As Long, ByRef pidl As LPITEMIDLIST) As HRESULT 385 386 'shlobj.h 387 '要Win2k/Me 388 'Declare Function SHGetFolderLocation Lib "shell32" (hwndOwner As HWND, nFolder As Long, hToken As HANDLE, dwReserved As DWord, ByRef pidl As LPITEMIDLIST) As HRESULT 389 390 Const CSIDL_DESKTOP = &h0000 391 Const CSIDL_INTERNET = &h0001 392 Const CSIDL_PROGRAMS = &h0002 393 Const CSIDL_CONTROLS = &h0003 394 Const CSIDL_PRINTERS = &h0004 395 Const CSIDL_PERSONAL = &h0005 396 Const CSIDL_FAVORITES = &h0006 397 Const CSIDL_STARTUP = &h0007 398 Const CSIDL_RECENT = &h0008 399 Const CSIDL_SENDTO = &h0009 400 Const CSIDL_BITBUCKET = &h000a 401 Const CSIDL_STARTMENU = &h000b 402 Const CSIDL_MYMUSIC = &h000d 403 Const CSIDL_DESKTOPDIRECTORY = &h0010 404 Const CSIDL_DRIVES = &h0011 405 Const CSIDL_NETWORK = &h0012 406 Const CSIDL_NETHOOD = &h0013 407 Const CSIDL_FONTS = &h0014 408 Const CSIDL_TEMPLATES = &h0015 409 Const CSIDL_COMMON_STARTMENU = &h0016 410 Const CSIDL_COMMON_PROGRAMS = &h0017 411 Const CSIDL_COMMON_STARTUP = &h0018 412 Const CSIDL_COMMON_DESKTOPDIRECTORY = &h0019 413 Const CSIDL_APPDATA = &h001a 414 Const CSIDL_PRINTHOOD = &h001b 415 Const CSIDL_LOCAL_APPDATA = &h001c 416 Const CSIDL_ALTSTARTUP = &h001d 417 Const CSIDL_COMMON_ALTSTARTUP = &h001e 418 Const CSIDL_COMMON_FAVORITES = &h001f 419 Const CSIDL_INTERNET_CACHE = &h0020 420 Const CSIDL_COOKIES = &h0021 421 Const CSIDL_HISTORY = &h0022 422 Const CSIDL_COMMON_APPDATA = &h0023 423 Const CSIDL_WINDOWS = &h0024 424 Const CSIDL_SYSTEM = &h0025 425 Const CSIDL_PROGRAM_FILES = &h0026 426 Const CSIDL_MYPICTURES = &h0027 427 Const CSIDL_PROFILE = &h0028 428 Const CSIDL_PROGRAM_FILES_COMMON = &h002b 429 Const CSIDL_COMMON_TEMPLATES = &h002d 430 Const CSIDL_COMMON_DOCUMENTS = &h002e 431 Const CSIDL_COMMON_ADMINTOOLS = &h002f 432 Const CSIDL_ADMINTOOLS = &h0030 383 433 384 434 Const SHGFI_ICON = &H000000100 -
Include/api_system.sbp
r173 r258 213 213 Const MUTEX_ALL_ACCESS = MUTANT_ALL_ACCESS 214 214 215 'Lmcons.ab 216 Const UNLEN = 256 217 215 218 '---------------------- 216 219 ' Kernel Operation API … … 465 468 466 469 Const MAX_COMPUTERNAME_LENGTH = 15 467 Declare Function GetComputerName Lib "kernel32" Alias _FuncName_GetComputerName (pBuffer As PTSTR, ByRef nSize As Long) As Long470 Declare Function GetComputerName Lib "kernel32" Alias _FuncName_GetComputerName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL 468 471 469 472 Declare Function GetCurrentDirectory Lib "kernel32" Alias _FuncName_GetCurrentDirectory (nBufferLength As DWord, pBuffer As PTSTR) As DWord -
Include/basic.sbp
r255 r258 12 12 End Sub 13 13 14 Const QWORD_MAX = &HFFFFFFFFFFFFFFFF As QWord 15 Const INT64_MAX = &H7FFFFFFFFFFFFFFF As Int64 16 Const INT64_MIN = &H8000000000000000 As Int64 14 17 15 Const LONG_MAX = &H7FFFFFFF 16 Const LONG_MIN = &H80000000 18 Const DWORD_MAX = &HFFFFFFFF As DWord 19 Const LONG_MAX = &H7FFFFFFF As Long 20 Const LONG_MIN = &H80000000 As Long 21 22 Const WORD_MAX = &HFFFF As Word 23 Const INTEGER_MAX = &H7FFF As Integer 24 Const INTEGER_MIN = &H8000 As Integer 25 26 Const BYTE_MAX = &HFF As Byte 27 Const SBYTE_MAX = &H7F As SByte 28 Const SBYTE_MIN = &H80 As SByte 29 30 Const DBL_MAX = 1.7976931348623158e+308 31 Const DBL_MIN = 2.2250738585072014e-308 17 32 18 33 Const FLT_MAX = 3.402823466e+38 -
Include/basic/command.sbp
r251 r258 34 34 35 35 Sub _System_End() 36 Dim exitCode = Environment.ExitCode36 Dim exitCode = System.Environment.ExitCode 37 37 _System_EndProgram() 38 38 ExitProcess(exitCode) -
Include/basic/function.sbp
r257 r258 1231 1231 End Function 1232 1232 1233 Namespace ActiveBasic 1234 Namespace Windows 1235 Function GetPathFromIDList(pidl As LPITEMIDLIST) As String 1236 Dim buf[ELM(MAX_PATH)] As TCHAR 1237 If SHGetPathFromIDList(pidl, buf) Then 1238 Return New String(buf) 1239 Else 1240 Return "" 1241 End If 1242 End Function 1243 1244 Function GetFolderPath(hwnd As HWND, folder As Long) As String 1245 Dim pidl As LPITEMIDLIST 1246 Dim hr = SHGetSpecialFolderLocation(hwnd, folder, pidl) 1247 If SUCCEEDED(hr) Then 1248 GetFolderPath = GetPathFromIDList(pidl) 1249 CoTaskMemFree(pidl) 1250 Else 1251 GetFolderPath = "" 1252 End If 1253 End Function 1254 1255 Function GetFolderPath(folder As Long) As String 1256 Return GetFolderPath(0, folder) 1257 End Function 1258 End Namespace 1259 End Namespace 1260 1233 1261 #endif '_INC_FUNCTION -
Include/basic/prompt.sbp
r208 r258 5 5 #define _INC_PROMPT 6 6 7 8 7 #require <api_imm.sbp> 9 8 #require <Classes/System/Math.ab> 10 9 #require <Classes/System/Environment.ab> 10 11 Namespace ActiveBasic 12 Namespace Prompt 13 Namespace Detail 14 11 15 Function _PromptSys_GetTextExtentPoint32(hdc As HDC, psz As PCSTR, cb As Long, ByRef Size As SIZE) As Long 12 16 _PromptSys_GetTextExtentPoint32 = GetTextExtentPoint32A(hdc, psz, cb, Size) … … 50 54 End Type 51 55 52 Dim _PromptSys_LogFont As LOGFONT53 56 Dim _PromptSys_hFont As HFONT 54 57 Dim _PromptSys_FontSize As SIZE 55 58 Dim _PromptSys_InputStr[255] As StrChar 56 Dim _PromptSys_InputLen As Long59 Dim _PromptSys_InputLen = -1 As Long 57 60 Dim _PromptSys_KeyChar As Byte 58 61 Dim _PromptSys_CurPos As POINTAPI … … 64 67 Dim _System_OSVersionInfo As OSVERSIONINFO 65 68 66 _PromptSys_InputLen = -167 69 68 70 'graphic … … 72 74 Dim _PromptSys_GlobalPos As POINTAPI 73 75 76 Sub _PromptSys_Initialize() 74 77 _PromptSys_hInitFinish = CreateEvent(0, FALSE, FALSE, 0) 75 Dim _PromptSys_hThread As HANDLE 76 _PromptSys_hThread = CreateThread(0, 0, AddressOf(PromptMain) As LPTHREAD_START_ROUTINE, 0, 0, _PromptSys_dwThreadID) 78 Dim _PromptSys_hThread = CreateThread(0, 0, AddressOf(PromptMain), 0, 0, _PromptSys_dwThreadID) 77 79 If _PromptSys_hThread = 0 Then 78 80 Debug … … 80 82 End If 81 83 WaitForSingleObject(_PromptSys_hInitFinish, INFINITE) 84 End Sub 82 85 83 86 Sub DrawPromptBuffer(hDC As HDC, StartLine As Long, EndLine As Long) … … 267 270 Dim ps As PAINTSTRUCT 268 271 Dim hdc = BeginPaint(hwnd, ps) 269 'With _PromptSys_ScreenSize270 'BitBlt(hdc, 0, 0, .cx, .cy, _PromptSys_hMemDC, 0, 0, SRCCOPY)271 With ps.rcPaint272 BitBlt(hdc, .left, .top, .right - .left, .bottom - .top, _PromptSys_hMemDC, .left, .top, SRCCOPY)272 With _PromptSys_ScreenSize 273 BitBlt(hdc, 0, 0, .cx, .cy, _PromptSys_hMemDC, 0, 0, SRCCOPY) 274 ' With ps.rcPaint 275 ' BitBlt(hdc, .left, .top, .right - .left, .bottom - .top, _PromptSys_hMemDC, .left, .top, SRCCOPY) 273 276 End With 274 277 DrawPromptBuffer(hdc, -1, 0) … … 287 290 End With 288 291 ImmSetCompositionWindow(himc, CompForm) 289 ImmSetCompositionFont(himc, _PromptSys_LogFont) 292 293 Dim lf As LOGFONT 294 GetObject(_PromptSys_hFont, Len(lf), lf) 295 ImmSetCompositionFont(himc, lf) 290 296 End If 291 297 ImmReleaseContext(hwnd, himc) … … 365 371 366 372 SendMessage(hwnd, WM_KILLFOCUS, 0, 0) 367 PRINT_ToPrompt(TempStr)373 ActiveBasic.Prompt.Detail.PRINT_ToPrompt(TempStr) 368 374 SendMessage(hwnd, WM_SETFOCUS, 0, 0) 369 375 End If … … 372 378 Function _PromptWnd_GetCompositionStringW(himc As HIMC, ByRef rpsz As PWSTR) As Long 373 379 Dim size = ImmGetCompositionStringW(himc, GCS_RESULTSTR, 0, 0) 'sizeはバイト単位 374 rpsz = _System_malloc(size) As P TSTR380 rpsz = _System_malloc(size) As PWSTR 375 381 If rpsz = 0 Then 376 382 'Debug … … 382 388 Function _PromptWnd_GetCompositionStringA(himc As HIMC, ByRef rpsz As PSTR) As Long 383 389 Dim size = ImmGetCompositionStringA(himc, GCS_RESULTSTR, 0, 0) 'sizeはバイト単位 384 rpsz = _System_malloc(size) As P TSTR390 rpsz = _System_malloc(size) As PSTR 385 391 If rpsz = 0 Then 386 392 'Debug … … 403 409 tempStr.Assign(str, size) 404 410 #else 405 With _System_OSVersionInfo 411 Dim osver = System.Environment.OSVersion 412 With osver 406 413 ' GetCompositionStringW is not implimented in Windows 95 407 If . dwMajorVersion = 4 And .dwMinorVersion = 0 And .dwPlatformId = VER_PLATFORM_WIN32_WINDOWSThen414 If .Version.Major = 4 And .Version.Minor = 0 And .Platform = System.PlatformID.Win32Windows Then 408 415 Dim strA As PCSTR 409 416 Dim sizeA = _PromptWnd_GetCompositionStringA(himc, strA) … … 421 428 _PromptSys_InputLen += tempStr.Length 422 429 423 SendMessage(hwnd, WM_KILLFOCUS, 0, 0) : Debug424 PRINT_ToPrompt(tempStr)430 SendMessage(hwnd, WM_KILLFOCUS, 0, 0) 431 ActiveBasic.Prompt.Detail.PRINT_ToPrompt(tempStr) 425 432 SendMessage(hwnd, WM_SETFOCUS, 0, 0) 426 433 … … 454 461 End With 455 462 456 'LogFont initialize 457 With _PromptSys_LogFont 463 '_PromptSys_hFont initialize 464 Dim lf As LOGFONT 465 With lf 458 466 .lfHeight = -16 459 467 .lfWidth = 0 … … 469 477 .lfQuality = DEFAULT_QUALITY 470 478 .lfPitchAndFamily = FIXED_PITCH 471 lstrcpy(.lfFaceName, "MS 明朝")472 End With 473 474 _PromptSys_hFont = CreateFontIndirect( _PromptSys_LogFont)479 lstrcpy(.lfFaceName, ToTCStr("MS 明朝")) 480 End With 481 482 _PromptSys_hFont = CreateFontIndirect(lf) 475 483 476 484 'Critical Section … … 487 495 .hIconSm = LoadImage(0, MAKEINTRESOURCE(IDI_WINLOGO), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE Or LR_SHARED) As HICON 488 496 .hCursor = LoadImage(0, MAKEINTRESOURCE(IDC_ARROW), IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE Or LR_SHARED) As HCURSOR 489 .lpszClassName = "PROMPT"497 .lpszClassName = ToTCStr("PROMPT") 490 498 .lpfnWndProc = AddressOf(PromptProc) 491 499 .hbrBackground = GetStockObject(BLACK_BRUSH) … … 494 502 495 503 'Create Prompt Window 496 _PromptSys_hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, atom As ULONG_PTR As LPCTSTR, "BASIC PROMPT", _504 _PromptSys_hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, atom As ULONG_PTR As LPCTSTR, ToTCStr("BASIC PROMPT"), _ 497 505 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, _ 498 506 0, 0, wcl.hInstance, 0) … … 503 511 Do 504 512 Dim iResult = GetMessage(msg, 0, 0, 0) 505 If iResult = 0 Or iResult = -1 Then Exit Do 513 If iResult = 0 Then 514 System.Environment.ExitCode = msg.wParam As Long 515 Exit Do 516 ElseIf iResult = -1 Then 517 Exit Do 518 End If 506 519 TranslateMessage(msg) 507 520 DispatchMessage(msg) … … 509 522 510 523 '強制的に終了する 511 End 'ExitProcess(0)524 End 512 525 513 526 EnterCriticalSection(_PromptSys_SectionOfBufferAccess) … … 522 535 DeleteCriticalSection(_PromptSys_SectionOfBufferAccess) 523 536 524 End 'ExitProcess(0) 525 End Function 526 527 528 '---------------------- 529 ' Prompt text Commands 530 '---------------------- 531 532 Macro CLS()(num As Long) 537 End 538 End Function 539 540 'Prompt text command functoins 541 542 Sub Cls(n As Long) 533 543 Dim i As Long 534 544 535 545 'When parameter was omitted, num is set to 1 536 If n um = 0 Then num= 1537 538 If n um = 1 Or num= 3 Then546 If n = 0 Then n = 1 547 548 If n = 1 Or n = 3 Then 539 549 'Clear the text screen 540 550 For i = 0 To 100 … … 550 560 End If 551 561 552 If n um = 2 Or num= 3 Then562 If n = 2 Or n = 3 Then 553 563 'Clear the graphics screen 554 564 Dim hOldBrush = SelectObject(_PromptSys_hMemDC, GetStockObject(BLACK_BRUSH)) … … 561 571 'Redraw 562 572 InvalidateRect(_PromptSys_hWnd, ByVal 0, 0) 563 End Macro564 565 Macro COLOR(TextColorCode As Long)(BackColorCode As Long)566 _PromptSys_NowTextColor = GetBasicColor( TextColorCode)567 If BackColorCode = -1 Then573 End Sub 574 575 Sub Color(textColorCode As Long, backColorCode As Long) 576 _PromptSys_NowTextColor = GetBasicColor(textColorCode) 577 If backColorCode = -1 Then 568 578 _PromptSys_NowBackColor = -1 569 579 Else 570 _PromptSys_NowBackColor = GetBasicColor(BackColorCode) 571 End If 572 End Macro 573 574 '---------- Defined in "command.sbp" ---------- 575 'Dim _System_InputDataPtr[_System_MAX_PARMSNUM] As VoidPtr 576 'Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord 577 '---------------------------------------------- 578 Sub INPUT_FromPrompt(ShowStr As String) 580 _PromptSys_NowBackColor = GetBasicColor(backColorCode) 581 End If 582 End Sub 583 584 Sub INPUT_FromPrompt(showStr As String) 579 585 Dim i As Long, i2 As Long, i3 As Long 580 586 Dim buf As String … … 582 588 *InputReStart 583 589 584 PRINT_ToPrompt(ShowStr)590 ActiveBasic.Prompt.Detail.PRINT_ToPrompt(showStr) 585 591 586 592 'Input by keyboard … … 616 622 i++ 617 623 If _System_InputDataPtr[i] = 0 and _PromptSys_InputStr[i2] = &h2c Then 'Asc(",") 618 PRINT_ToPrompt(Ex"入力データの個数が多すぎます\r\n")624 ActiveBasic.Prompt.Detail.PRINT_ToPrompt(Ex"入力データの個数が多すぎます\r\n") 619 625 Goto *InputReStart 620 626 ElseIf _PromptSys_InputStr[i2] = 0 Then 621 627 If _System_InputDataPtr[i]<>0 Then 622 PRINT_ToPrompt(Ex"入力データの個数が足りません\r\n")628 ActiveBasic.Prompt.Detail.PRINT_ToPrompt(Ex"入力データの個数が足りません\r\n") 623 629 Goto *InputReStart 624 630 Else … … 631 637 End Sub 632 638 633 Sub PRINTUSING_ToPrompt(UsingStr As String) 634 PRINT_ToPrompt(_System_GetUsingFormat(UsingStr)) 635 End Sub 636 637 Macro LOCATE(x As Long, y As Long) 639 Sub Locate(x As Long, y As Long) 638 640 If x < 0 Then x = 0 639 641 If y < 0 Then y = 0 … … 653 655 _PromptSys_TextLine[y].Length = x 654 656 End If 655 End Macro 656 657 658 '------------------- 659 ' Graphics Commands 660 '------------------- 661 662 Macro CIRCLE(x As Long , y As Long, radius As Long)(ColorCode As Long, StartPos As Double, EndPos As Double, Aspect As Double, bFill As Long, BrushColor As Long) 663 '呼び出し方法は以下のようになります(コンパイラがパラメータの並びを最適化します) 664 'Circle (x, y), radius [, color] [, start] [, end] [, aspect] [, f] [, color2] 665 657 End Sub 658 659 'Prompt graphic command functions 660 661 Sub Circle(x As Long , y As Long, radius As Long, ColorCode As Long, StartPos As Double, EndPos As Double, Aspect As Double, bFill As Long, BrushColor As Long) 666 662 Dim i1 As Long, i2 As Long, i3 As Long, i4 As Long 667 663 … … 763 759 DeleteObject(hPen) 764 760 If bFill Then DeleteObject(hBrush) 765 End Macro 766 767 Macro LINE(sx As Long, sy As Long, bStep As Long, ex As Long, ey As Long)(ColorCode As Long, fType As Long, BrushColor As Long) 768 '呼び出し方法は以下のようになります(コンパイラがパラメータの並びを最適化します) 769 'Line (sx,sy)-[STEP](ex,ey),[ColorCode],[B/Bf],[BrushColor] 761 End Sub 762 763 Sub Line(sx As Long, sy As Long, bStep As Long, ex As Long, ey As Long, ColorCode As Long, fType As Long, BrushColor As Long) 770 764 Dim temp As Long 771 765 … … 796 790 End If 797 791 798 Dim h DC= GetDC(_PromptSys_hWnd)792 Dim hdc = GetDC(_PromptSys_hWnd) 799 793 Dim hPen = CreatePen(PS_SOLID, 1, GetBasicColor(ColorCode)) 800 794 Dim hBrush As HBRUSH … … 805 799 End If 806 800 807 SelectObject(h DC, hPen)808 SelectObject(h DC, hBrush)801 SelectObject(hdc, hPen) 802 SelectObject(hdc, hBrush) 809 803 Dim hOldPen = SelectObject(_PromptSys_hMemDC, hPen) 810 804 Dim hOldBrush = SelectObject(_PromptSys_hMemDC, hBrush) … … 816 810 LineTo(_PromptSys_hMemDC,ex,ey) 817 811 SetPixel(_PromptSys_hMemDC,ex,ey,GetBasicColor(ColorCode)) 818 MoveToEx(h DC,sx,sy,ByVal NULL)819 LineTo(h DC,ex,ey)820 SetPixel(h DC,ex,ey,GetBasicColor(ColorCode))812 MoveToEx(hdc,sx,sy,ByVal NULL) 813 LineTo(hdc,ex,ey) 814 SetPixel(hdc,ex,ey,GetBasicColor(ColorCode)) 821 815 Case Else 822 816 'Rectangle 823 Rectangle(h DC,sx,sy,ex+1,ey+1)817 Rectangle(hdc,sx,sy,ex+1,ey+1) 824 818 Rectangle(_PromptSys_hMemDC,sx,sy,ex+1,ey+1) 825 819 End Select 826 820 827 ReleaseDC(_PromptSys_hWnd,h DC)821 ReleaseDC(_PromptSys_hWnd,hdc) 828 822 SelectObject(_PromptSys_hMemDC,hOldPen) 829 823 SelectObject(_PromptSys_hMemDC,hOldBrush) … … 834 828 .y = ey 835 829 End With 836 End Macro 837 838 Macro PSET(x As Long, y As Long)(ColorCode As Long) 839 '呼び出し方法は以下のようになります(コンパイラがパラメータの並びを最適化します) 840 'PSet (x,y),ColorCode 841 842 Dim hDC = GetDC(_PromptSys_hWnd) 843 SetPixel(hDC, x, y, GetBasicColor(ColorCode)) 830 End Sub 831 832 Sub PSet(x As Long, y As Long, ColorCode As Long) 833 Dim hdc = GetDC(_PromptSys_hWnd) 834 SetPixel(hdc, x, y, GetBasicColor(ColorCode)) 844 835 SetPixel(_PromptSys_hMemDC, x, y, GetBasicColor(ColorCode)) 845 ReleaseDC(_PromptSys_hWnd, h DC)836 ReleaseDC(_PromptSys_hWnd, hdc) 846 837 With _PromptSys_GlobalPos 847 838 .x = x 848 839 .y = y 849 840 End With 850 End Macro 851 852 Macro PAINT(x As Long, y As Long, BrushColor As Long)(ByVal LineColor As Long) 853 '呼び出し方法は以下のようになります(コンパイラがパラメータの並びを最適化します) 854 'Paint (x,y),BrushColor,LineColor 855 856 Dim hBrush = CreateSolidBrush(GetBasicColor(BrushColor)) 857 858 Dim hDC = GetDC(_PromptSys_hWnd) 859 Dim hOldBrush = SelectObject(_PromptSys_hMemDC, hBrush) 860 Dim hOldBrushWndDC = SelectObject(hDC, hBrush) 861 862 ExtFloodFill(hDC, x, y, GetBasicColor(LineColor), FLOODFILLBORDER) 841 End Sub 842 843 Sub Paint(x As Long, y As Long, BrushColor As Long, LineColor As Long) 844 Dim hbr = CreateSolidBrush(GetBasicColor(BrushColor)) 845 846 Dim hdc = GetDC(_PromptSys_hWnd) 847 Dim hbrOld = SelectObject(_PromptSys_hMemDC, hbr) 848 Dim hbrOldWndDC = SelectObject(hdc, hbr) 849 850 ExtFloodFill(hdc, x, y, GetBasicColor(LineColor), FLOODFILLBORDER) 863 851 ExtFloodFill(_PromptSys_hMemDC, x, y, GetBasicColor(LineColor), FLOODFILLBORDER) 864 852 865 ReleaseDC(_PromptSys_hWnd, hDC) 866 SelectObject(_PromptSys_hMemDC, hOldBrush) 867 SelectObject(hDC, hOldBrushWndDC) 868 DeleteObject(hBrush) 869 End Macro 870 871 872 '----------- 873 ' Functions 874 '----------- 853 ReleaseDC(_PromptSys_hWnd, hdc) 854 SelectObject(_PromptSys_hMemDC, hbrOld) 855 SelectObject(hdc, hbrOldWndDC) 856 DeleteObject(hbr) 857 End Sub 875 858 876 859 Function Inkey$() As String … … 884 867 885 868 Function Input$(length As Long) As String 886 Dim i As Long869 Dim i = 0 As Long 887 870 888 871 If length<=0 Then … … 891 874 End If 892 875 893 i=0894 876 While 1 895 877 If _PromptSys_KeyChar Then … … 905 887 End Function 906 888 889 End Namespace 'Detail 890 891 Function OwnerWnd() As HWND 892 Return Detail._PromptSys_hWnd 893 End Function 894 895 End Namespace 'Prompt 896 End Namespace 'ActiveBasic 897 898 '---------------------- 899 ' Prompt text Commands 900 '---------------------- 901 902 Sub PRINT_ToPrompt(s As String) 903 ActiveBasic.Prompt.Detail.PRINT_ToPrompt(s) 904 End Sub 905 906 Macro CLS()(num As Long) 907 ActiveBasic.Prompt.Detail.Cls(num) 908 End Macro 909 910 Macro COLOR(TextColorCode As Long)(BackColorCode As Long) 911 ActiveBasic.Prompt.Detail.Color(TextColorCode, BackColorCode) 912 End Macro 913 914 '---------- Defined in "command.sbp" ---------- 915 'Dim _System_InputDataPtr[_System_MAX_PARMSNUM] As VoidPtr 916 'Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord 917 '---------------------------------------------- 918 Sub INPUT_FromPrompt(ShowStr As String) 919 ActiveBasic.Prompt.Detail.INPUT_FromPrompt(ShowStr) 920 End Sub 921 922 Sub PRINTUSING_ToPrompt(UsingStr As String) 923 ActiveBasic.Prompt.Detail.PRINT_ToPrompt(_System_GetUsingFormat(UsingStr)) 924 End Sub 925 926 Macro LOCATE(x As Long, y As Long) 927 ActiveBasic.Prompt.Detail.Locate(x, y) 928 End Macro 929 930 931 '------------------- 932 ' Graphics Commands 933 '------------------- 934 935 Macro CIRCLE(x As Long , y As Long, radius As Long)(ColorCode As Long, StartPos As Double, EndPos As Double, Aspect As Double, bFill As Long, BrushColor As Long) 936 '呼び出し方法は以下のようになります(コンパイラがパラメータの並びを最適化します) 937 'Circle (x, y), radius [, color] [, start] [, end] [, aspect] [, f] [, color2] 938 ActiveBasic.Prompt.Detail.Circle(x, y, radius, ColorCode, StartPos, EndPos, Aspect, bFill, BrushColor) 939 End Macro 940 941 Macro LINE(sx As Long, sy As Long, bStep As Long, ex As Long, ey As Long)(ColorCode As Long, fType As Long, BrushColor As Long) 942 '呼び出し方法は以下のようになります(コンパイラがパラメータの並びを最適化します) 943 'Line (sx,sy)-[STEP](ex,ey),[ColorCode],[B/Bf],[BrushColor] 944 ActiveBasic.Prompt.Detail.Line(sx, sy, bStep, ex, ey, ColorCode, fType, BrushColor) 945 End Macro 946 947 Macro PSET(x As Long, y As Long)(ColorCode As Long) 948 '呼び出し方法は以下のようになります(コンパイラがパラメータの並びを最適化します) 949 'PSet (x,y),ColorCode 950 ActiveBasic.Prompt.Detail.PSet(x, y, ColorCode) 951 End Macro 952 953 Macro PAINT(x As Long, y As Long, BrushColor As Long)(ByVal LineColor As Long) 954 '呼び出し方法は以下のようになります(コンパイラがパラメータの並びを最適化します) 955 'Paint (x,y),BrushColor,LineColor 956 ActiveBasic.Prompt.Detail.Paint(x, y, BrushColor, LineColor) 957 End Macro 958 959 960 '----------- 961 ' Functions 962 '----------- 963 964 Function Inkey$() As String 965 Return ActiveBasic.Prompt.Detail.Inkey$() 966 End Function 967 968 Function Input$(length As Long) As String 969 Return ActiveBasic.Prompt.Detail.Input$(length) 970 End Function 971 972 ActiveBasic.Prompt.Detail._PromptSys_Initialize() 907 973 908 974 #endif '_INC_PROMPT -
Include/system/string.sbp
r237 r258 157 157 158 158 Function GetTCStr(s As String, ByRef tcs As PCTSTR) As SIZE_T 159 Return GetStr(s.Chars, s.Length As SIZE_T, wcs)159 Return GetStr(s.Chars, s.Length As SIZE_T, tcs) 160 160 End Function 161 161 … … 177 177 178 178 Function GetSCStr(s As String, ByRef ss As *StrChar) As SIZE_T 179 Return GetStr(s.Chars, s.Length As SIZE_T, wcs)179 Return GetStr(s.Chars, s.Length As SIZE_T, ss) 180 180 End Function 181 181
Note:
See TracChangeset
for help on using the changeset viewer.