- Timestamp:
- Jul 13, 2008, 11:54:55 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/WindowHandle.sbp
r545 r547 31 31 Declare Function _System_IsWindow Lib "user32" Alias "IsWindow" (hWnd As HWND) As BOOL 32 32 Declare Function _System_IsIconic Lib "user32" Alias "IsIconic" (hWnd As HWND) As BOOL 33 Declare Function _System_GetClientRect Lib "user32" Alias "GetClientRect" (hWnd As HWND, ByRef Rect As RECT) As BOOL34 Declare Function _System_GetProp Lib "user32" Alias _FuncName_GetProp (hWnd As HWND, pString As PCTSTR) As HANDLE35 Declare Function _System_SetProp Lib "user32" Alias _FuncName_SetProp (hWnd As HWND, pString As PCTSTR, hData As HANDLE) As BOOL36 33 Declare Function _System_GetClassName Lib "user32" Alias _FuncName_GetClassName (hWnd As HWND, lpClassName As PTSTR, nMaxCount As Long) As Long 37 34 Declare Function _System_GetScrollInfo Lib "user32" Alias "GetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO) As BOOL … … 69 66 Return hwnd 70 67 End Function 71 68 /* 69 Static Function FromHWnd(hwnd As HWND) As WindowHandle 70 FromHWnd = Control.FromHWnd(hwnd) 71 If IsNothing(FromHWnd) Then 72 FromHWnd = New WindowHandle(hwnd) 73 End If 74 End Function 75 */ 72 76 Function BringToTop() As Boolean 73 77 Return BringWindowToTop(hwnd) As Boolean … … 76 80 Function BeginPaint(ByRef ps As PAINTSTRUCT) As HDC 77 81 Return _System_BeginPaint(hwnd, ps) 82 End Function 83 84 Function BeginPaint() As PAINTSTRUCT 85 _System_BeginPaint(hwnd, BeginPaint) 78 86 End Function 79 87 /* … … 139 147 End Function 140 148 141 Const Function GetClientRect(ByRef rc As RECT) As Boolean142 Return _System_GetClientRect(hwnd, rc) As Boolean143 End Function144 149 /* 145 150 Const Function GetContextHelpId() As DWord … … 175 180 End Function 176 181 */ 177 Const Function GetProp(str As String) As HANDLE178 Return _System_GetProp(hwnd, ToTCStr(str))179 End Function180 181 Const Function GetProp(psz As PCTSTR) As HANDLE182 Return _System_GetProp(hwnd, psz)183 End Function184 185 Const Function GetProp(atom As ATOM) As HANDLE186 Return _System_GetProp(hwnd, atom As ULONG_PTR As PCTSTR)187 End Function188 189 182 Const Function GetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO) As Boolean 190 183 Return _System_GetScrollInfo(hwnd, fnBar, si) As Boolean … … 219 212 End Function 220 213 */ 221 Const Function GetWindowRect(ByRef rc As RECT) As Boolean222 Return _System_GetWindowRect(hwnd, rc) As Boolean223 End Function224 225 214 Const Function GetText(ps As PTSTR, maxCount As Long) As Boolean 226 215 Return GetWindowText(hwnd, ps, maxCount) As Boolean 227 End Function228 229 Const Function GetTextLength() As Long230 Return GetWindowTextLength(hwnd)231 End Function232 233 Const Function GetWindowThreadId() As DWord234 Return _System_GetWindowThreadProcessId(hwnd, 0)235 216 End Function 236 217 … … 444 425 End Function 445 426 446 Function SetProp(str As String, hData As HANDLE) As Boolean447 Return _System_SetProp(hwnd, ToTCStr(str), hData) As Boolean448 End Function449 450 Function SetProp(psz As PCTSTR, hData As HANDLE) As Boolean451 Return _System_SetProp(hwnd, psz, hData) As Boolean452 End Function453 454 Function SetProp(atom As ATOM, hData As HANDLE) As Boolean455 Return This.SetProp((atom As ULONG_PTR) As PCTSTR, hData) As Boolean456 End Function457 458 427 Function SetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO, redraw As Boolean) As Boolean 459 428 Return _System_SetScrollInfo(hwnd, fnBar, si, redraw) As Boolean … … 502 471 End Function 503 472 504 Function SetText(psz As PCTSTR) As Boolean505 Return SetWindowText(hwnd, psz) As Boolean506 End Function507 508 Function SetText(str As String) As Boolean509 Return SetWindowText(hwnd, ToTCStr(str)) As Boolean510 End Function511 512 473 Function ShowCaret() As Boolean 513 474 Return _System_ShowCaret(hwnd) As Boolean … … 546 507 End Function 547 508 548 ' Get/SetWindowLongPtr Wrappers549 550 Const Function GetExStyle() As DWord551 Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord552 End Function553 554 Const Function GetStyle() As DWord555 Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord556 End Function557 #ifdef _UNDEF558 Const Function GetWndProc() As WNDPROC559 Return _System_GetWindowLongPtr(hwnd, GWLP_WNDPROC) As WNDPROC560 End Function561 #endif562 Const Function GetInstance() As HINSTANCE563 Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE564 End Function565 566 Const Function GetUserData() As LONG_PTR567 Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)568 End Function569 570 Function SetExStyle(style As DWord) As DWord571 Return _System_SetWindowLongPtr(hwnd, GWL_EXSTYLE, style) As DWord572 End Function573 574 Function SetStyle(style As DWord) As DWord575 Return _System_SetWindowLongPtr(hwnd, GWL_STYLE, style) As DWord576 End Function577 #ifdef _UNDEF578 Function SetWndProc(wndProc As WNDPROC) As WNDPROC579 Return _System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, wndProc As WNDPROC) As WNDPROC580 End Function581 #endif582 Function SetUserData(value As LONG_PTR) As LONG_PTR583 Return _System_SetWindowLongPtr(hwnd, GWLP_USERDATA, value As LONG_PTR)584 End Function585 586 509 ' Propaties 587 510 588 511 Const Function ClientRect() As RECT 589 _System_GetClientRect(hwnd, ClientRect)512 GetClientRect(hwnd, ClientRect) 590 513 End Function 591 514 #ifdef _UNDEF … … 717 640 718 641 Const Function Prop(str As String) As HANDLE 719 Return GetProp( str)642 Return GetProp(hwnd, ToTCStr(str)) 720 643 End Function 721 644 722 645 Const Function Prop(psz As PCTSTR) As HANDLE 723 Return GetProp( psz)646 Return GetProp(hwnd, psz) 724 647 End Function 725 648 726 649 Const Function Prop(atom As ATOM) As HANDLE 727 Return GetProp(atom) 728 End Function 650 Return GetProp(hwnd, atom As ULONG_PTR As PCTSTR) 651 End Function 652 653 Sub Prop(str As String, hData As HANDLE) 654 SetProp(hwnd, ToTCStr(str), hData) 655 End Sub 729 656 730 657 Sub Prop(str As PCTSTR, h As HANDLE) 731 SetProp( str, h)658 SetProp(hwnd, str, h) 732 659 End Sub 733 660 734 661 Sub Prop(atom As ATOM, h As HANDLE) 735 SetProp( atom, h)662 SetProp(hwnd, atom As ULONG_PTR As PCTSTR, h) 736 663 End Sub 737 664 738 665 Const Function Text() As String 739 666 Dim size = GetWindowTextLength(hwnd) + 1 740 Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PTSTR 741 Dim length = GetWindowText(hwnd, p, size) 742 Text = New String(p, length As Long) 667 Dim sb = New System.Text.StringBuilder(size) 668 sb.Length = size 669 Dim length = GetWindowText(hwnd, StrPtr(sb), size) 670 Text = sb.ToString 743 671 End Function 744 672
Note:
See TracChangeset
for help on using the changeset viewer.