[208] | 1 | ' Windows/WindowHandle.sbp
|
---|
| 2 |
|
---|
[192] | 3 | #ifndef __WINDOWS_WINDOWHANDLE_SBP__
|
---|
| 4 | #define __WINDOWS_WINDOWHANDLE_SBP__
|
---|
[1] | 5 |
|
---|
[77] | 6 | #ifdef _WIN64
|
---|
[272] | 7 | Declare Function _System_GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
|
---|
| 8 | Declare Function _System_SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLongPtr (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
|
---|
[192] | 9 | Declare Function _System_GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
|
---|
| 10 | Declare Function _System_SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLongPtr (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
|
---|
[77] | 11 | #else
|
---|
[272] | 12 | Declare Function _System_GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLong (hWnd As HWND, nIndex As Long) As LONG_PTR
|
---|
| 13 | Declare Function _System_SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLong (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
|
---|
[192] | 14 | Declare Function _System_GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLong (hWnd As HWND, nIndex As Long) As LONG_PTR
|
---|
| 15 | Declare Function _System_SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLong (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
|
---|
[77] | 16 | #endif
|
---|
| 17 | Declare Function _System_GetParent Lib "user32" Alias "GetParent" (hWnd As HWND) As HWND
|
---|
| 18 | Declare Function _System_SetParent Lib "user32" Alias "SetParent" (hWnd As HWND) As HWND
|
---|
| 19 | Declare Function _System_GetMenu Lib "user32" Alias "GetMenu" (hWnd As HWND) As HMENU
|
---|
| 20 | Declare Function _System_SetMenu Lib "user32" Alias "SetMenu" (hWnd As HWND) As HMENU
|
---|
| 21 | Declare Function _System_InvalidateRect Lib "user32" Alias "InvalidateRect" (hWnd As HWND, ByRef Rect As RECT, bErase As BOOL) As BOOL
|
---|
| 22 | Declare Function _System_InvalidateRgn Lib "user32" Alias "InvalidateRgn" (hWnd As HWND, hRgn As HRGN, bErase As BOOL) As BOOL
|
---|
| 23 | Declare Function _System_ValidateRect Lib "user32" Alias "ValidateRect" (hWnd As HWND, ByRef Rect As RECT) As BOOL
|
---|
| 24 | Declare Function _System_ValidateRgn Lib "user32" Alias "ValidateRgn" (hWnd As HWND, hRgn As HRGN) As BOOL
|
---|
| 25 | Declare Function _System_BeginPaint Lib "user32" Alias "BeginPaint" (hWnd As HWND, ByRef ps As PAINTSTRUCT) As HDC
|
---|
[192] | 26 | Declare Function _System_EndPaint Lib "user32" Alias "EndPaint" (hWnd As HWND, ByRef ps As PAINTSTRUCT) As HDC
|
---|
| 27 | Declare Function _System_ClientToScreen Lib "user32" Alias "ClientToScreen" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
|
---|
| 28 | Declare Function _System_ScreenToClient Lib "user32" Alias "ScreenToClient" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
|
---|
[77] | 29 | Declare Function _System_CreateCaret Lib "user32" Alias "CreateCaret" (hWnd As HWND, hBitmap As HBITMAP, nWidth As Long, nHeight As Long) As BOOL
|
---|
| 30 | Declare Function _System_HideCaret Lib "user32" Alias "HideCaret" (hWnd As HWND) As BOOL
|
---|
| 31 | Declare Function _System_ShowCaret Lib "user32" Alias "ShowCaret" (hWnd As HWND) As BOOL
|
---|
| 32 | Declare Function _System_DrawMenuBar Lib "user32" Alias "DrawMenuBar" (hwnd As HWND) As BOOL
|
---|
| 33 | Declare Function _System_GetWindowRect Lib "user32" Alias "DrawMenuBar" (hWnd As HWND, ByRef Rect As RECT) As BOOL
|
---|
| 34 | Declare Function _System_IsWindow Lib "user32" Alias "IsWindow" (hWnd As HWND) As BOOL
|
---|
| 35 | Declare Function _System_Isiconic Lib "user32" Alias "Isiconic" (hWnd As HWND) As BOOL
|
---|
[192] | 36 | Declare Function _System_GetClientRect Lib "user32" Alias "GetClientRect" (hWnd As HWND, ByRef Rect As RECT) As BOOL
|
---|
[272] | 37 | Declare Function _System_GetProp Lib "user32" Alias _FuncName_GetProp (hWnd As HWND, pString As PCTSTR) As HANDLE
|
---|
| 38 | Declare Function _System_SetProp Lib "user32" Alias _FuncName_SetProp (hWnd As HWND, pString As PCTSTR, hData As HANDLE) As BOOL
|
---|
| 39 | Declare Function _System_GetClassName Lib "user32" Alias _FuncName_GetClassName (hWnd As HWND, lpClassName As PTSTR, nMaxCount As Long) As Long
|
---|
| 40 | Declare Function _System_GetScrollInfo Lib "user32" Alias "GetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO) As BOOL
|
---|
| 41 | Declare Function _System_SetScrollInfo Lib "user32" Alias "SetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO, bRedraw As Long) As BOOL
|
---|
| 42 | Declare Function _System_GetSystemMenu Lib "user32" Alias "GetSystemMenu" (hWnd As HWND, bRevert As BOOL) As HMENU
|
---|
[77] | 43 |
|
---|
[1] | 44 | Class WindowHandle
|
---|
| 45 | hwnd As HWND
|
---|
| 46 | Public
|
---|
| 47 | Sub WindowHandle()
|
---|
| 48 | hwnd = 0
|
---|
| 49 | End Sub
|
---|
| 50 |
|
---|
| 51 | Sub WindowHandle(hwndNew As HWND)
|
---|
| 52 | hwnd = hwndNew
|
---|
| 53 | End Sub
|
---|
| 54 |
|
---|
[192] | 55 | Sub WindowHandle(wnd As WindowHandle)
|
---|
[1] | 56 | hwnd = wnd.hwnd
|
---|
| 57 | End Sub
|
---|
[42] | 58 |
|
---|
[1] | 59 | Sub Operator =(hwndNew As HWND)
|
---|
| 60 | hwnd = hwndNew
|
---|
| 61 | End Sub
|
---|
[42] | 62 |
|
---|
[77] | 63 | Const Function HWnd() As HWND
|
---|
[1] | 64 | Return hwnd
|
---|
| 65 | End Function
|
---|
[42] | 66 |
|
---|
[77] | 67 | Const Function Operator() As HWND
|
---|
[1] | 68 | Return hwnd
|
---|
| 69 | End Function
|
---|
| 70 |
|
---|
[178] | 71 | Function BringToTop() As Boolean
|
---|
| 72 | Return BringWindowToTop(hwnd) As Boolean
|
---|
[77] | 73 | End Function
|
---|
| 74 |
|
---|
[1] | 75 | Function BeginPaint(ByRef ps As PAINTSTRUCT) As HDC
|
---|
[77] | 76 | Return _System_BeginPaint(hwnd, ps)
|
---|
[1] | 77 | End Function
|
---|
| 78 |
|
---|
[208] | 79 | Const Function ChildFromPoint(x As Long, y As Long) As WindowHandle
|
---|
| 80 | Return New WindowHandle(ChildWindowFromPoint(hwnd, x, y))
|
---|
[1] | 81 | End Function
|
---|
| 82 |
|
---|
[208] | 83 | Const Function ChildFromPointEx(x As Long, y As Long, flags As DWord) As WindowHandle
|
---|
| 84 | Return New WindowHandle(ChildWindowFromPointEx(hwnd, x, y, flags))
|
---|
[1] | 85 | End Function
|
---|
| 86 |
|
---|
[178] | 87 | Const Function ClientToScreen(ByRef pt As POINTAPI) As Boolean
|
---|
| 88 | Return _System_ClientToScreen(hwnd, pt) As Boolean
|
---|
[1] | 89 | End Function
|
---|
| 90 |
|
---|
[282] | 91 | Const Function ClientToScreen(ByRef rc As RECT) As Boolean
|
---|
| 92 | Dim ppt = VarPtr(rc) As *POINTAPI
|
---|
| 93 | Return (_System_ClientToScreen(hwnd, ppt[0]) <> FALSE And _System_ClientToScreen(hwnd, ppt[1]) <> FALSE) As Boolean
|
---|
| 94 | End Function
|
---|
| 95 |
|
---|
[178] | 96 | Function Close() As Boolean
|
---|
| 97 | Return CloseWindow(hwnd) As Boolean
|
---|
[1] | 98 | End Function
|
---|
| 99 |
|
---|
[178] | 100 | Function CreateCaret(hbmp As HBITMAP, width As Long, height As Long) As Boolean
|
---|
| 101 | Return _System_CreateCaret(hwnd, hbmp, width, hegiht) As Boolean
|
---|
[1] | 102 | End Function
|
---|
| 103 |
|
---|
[178] | 104 | Function Destroy() As Boolean
|
---|
| 105 | Return DestroyWindow(hwnd) As Boolean
|
---|
[1] | 106 | End Function
|
---|
| 107 |
|
---|
[178] | 108 | Function DrawMenuBar() As Boolean
|
---|
| 109 | Return _System_DrawMenuBar(hwnd) As Boolean
|
---|
[1] | 110 | End Function
|
---|
[42] | 111 |
|
---|
[178] | 112 | Function EnableScrollBar(SBFlags As DWord, arrows As DWord) As Boolean
|
---|
| 113 | Return EnableScrollBar(hwnd, SBFlags, arrows) As Boolean
|
---|
[1] | 114 | End Function
|
---|
| 115 |
|
---|
[178] | 116 | Function Enable(enable As Boolean) As Boolean
|
---|
| 117 | Return EnableWindow(hwnd, enable) As Boolean
|
---|
[1] | 118 | End Function
|
---|
| 119 |
|
---|
[178] | 120 | Function EndPaint(ByRef ps As PAINTSTRUCT) As Boolean
|
---|
| 121 | Return _System_EndPaint(hwnd, ps) As Boolean
|
---|
[1] | 122 | End Function
|
---|
| 123 |
|
---|
[178] | 124 | Const Function EnumChilds(enumFunc As WNDENUMPROC, lp As LPARAM) As Boolean
|
---|
| 125 | Return EnumChildWindows(hwnd, enumFunc, lp) As Boolean
|
---|
[1] | 126 | End Function
|
---|
| 127 |
|
---|
[178] | 128 | Function Flash(invert As Boolean) As Boolean
|
---|
| 129 | Return FlashWindow(hwnd, invert) As Boolean
|
---|
[1] | 130 | End Function
|
---|
| 131 |
|
---|
[77] | 132 | Const Function GetClassLongPtr(index As Long) As LONG_PTR
|
---|
[272] | 133 | Return _System_GetClassLongPtr(hwnd, index)
|
---|
[1] | 134 | End Function
|
---|
| 135 |
|
---|
[192] | 136 | Const Function GetClassName(className As PTSTR, maxCount As Long) As Long
|
---|
[272] | 137 | Return _System_GetClassName(className, maxCount)
|
---|
[1] | 138 | End Function
|
---|
| 139 |
|
---|
[178] | 140 | Const Function GetClientRect(ByRef rc As RECT) As Boolean
|
---|
| 141 | Return _System_GetClientRect(hwnd, rc) As Boolean
|
---|
[1] | 142 | End Function
|
---|
| 143 |
|
---|
[77] | 144 | Const Function GetContextHelpId() As DWord
|
---|
| 145 | Return GetWindowContextHelpId(hwnd)
|
---|
| 146 | End Function
|
---|
| 147 |
|
---|
[1] | 148 | Function GetDC() As HDC
|
---|
| 149 | Return GetDC(hwnd)
|
---|
| 150 | End Function
|
---|
| 151 |
|
---|
| 152 | Function GetDCEx(hrgnClip As HRGN, flags As DWord) As HDC
|
---|
| 153 | Return GetDCEx(hwnd, hrgnClip, flags)
|
---|
| 154 | End Function
|
---|
| 155 |
|
---|
[77] | 156 | Const Function GetDlgCtrlID() As Long
|
---|
[1] | 157 | Return GetDlgCtrlID(hwnd)
|
---|
| 158 | End Function
|
---|
| 159 |
|
---|
[77] | 160 | Const Function GetDlgItem(idDlgItem As Long) As WindowHandle
|
---|
[1] | 161 | Return GetDlgItem(hwnd, idDlgItem)
|
---|
| 162 | End Function
|
---|
| 163 |
|
---|
[192] | 164 | Const Function GetDlgItemText(idDlgItem As Long, ps As PTSTR, maxCount As Long) As Long
|
---|
[1] | 165 | Return GetDlgItemText(hwnd, idDlgItem, ps, maxCount)
|
---|
| 166 | End Function
|
---|
| 167 |
|
---|
[77] | 168 | Const Function GetMenu() As HMENU
|
---|
| 169 | Return _System_GetMenu(hwnd)
|
---|
[1] | 170 | End Function
|
---|
| 171 |
|
---|
[77] | 172 | Const Function GetParent() As WindowHandle
|
---|
| 173 | Dim w As WindowHandle(_System_GetParent(hwnd))
|
---|
| 174 | Return w
|
---|
[1] | 175 | End Function
|
---|
| 176 |
|
---|
[192] | 177 | Const Function GetProp(str As String) As HANDLE
|
---|
[272] | 178 | Return _System_GetProp(hwnd, ToTCStr(str))
|
---|
[192] | 179 | End Function
|
---|
| 180 |
|
---|
| 181 | Const Function GetProp(psz As PCTSTR) As HANDLE
|
---|
[272] | 182 | Return _System_GetProp(hwnd, psz)
|
---|
[1] | 183 | End Function
|
---|
| 184 |
|
---|
[77] | 185 | Const Function GetProp(atom As ATOM) As HANDLE
|
---|
[272] | 186 | Return _System_GetProp(hwnd, atom As ULONG_PTR As PCTSTR)
|
---|
[1] | 187 | End Function
|
---|
| 188 |
|
---|
[178] | 189 | Const Function GetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO) As Boolean
|
---|
[272] | 190 | Return _System_GetScrollInfo(hwnd, fnBar, si) As Boolean
|
---|
[1] | 191 | End Function
|
---|
| 192 |
|
---|
[178] | 193 | Const Function GetSystemMenu(revert As Boolean) As HMENU
|
---|
[1] | 194 | Return GetSystemMenu(hwnd, revert)
|
---|
| 195 | End Function
|
---|
| 196 |
|
---|
[178] | 197 | Const Function GetUpdateRect(ByRef rc As RECT, erase As Boolean) As Boolean
|
---|
| 198 | Return GetUpdateRact(hwnd, rc, erase) As Boolean
|
---|
[1] | 199 | End Function
|
---|
| 200 |
|
---|
[178] | 201 | Const Function GetUpdateRgn(hrgn As HRGN, erase As Boolean) As Boolean
|
---|
| 202 | Return GetUpdateRgn(hwnd, hrgn, erase) As Boolean
|
---|
[1] | 203 | End Function
|
---|
| 204 |
|
---|
[77] | 205 | Const Function GetWindow(cmd As DWord) As WindowHandle
|
---|
[1] | 206 | Return GetWindow(hwnd, cmd)
|
---|
| 207 | End Function
|
---|
| 208 |
|
---|
| 209 | Function GetWindowDC() As HDC
|
---|
| 210 | Return GetWindowDC(hwnd)
|
---|
| 211 | End Function
|
---|
| 212 |
|
---|
[77] | 213 | Const Function GetWindowLongPtr(index As Long) As LONG_PTR
|
---|
| 214 | Return _System_GetWindowLongPtr(hwnd, index)
|
---|
[1] | 215 | End Function
|
---|
| 216 |
|
---|
[178] | 217 | Const Function GetWindowPlasement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
|
---|
| 218 | Return GetWindowPlasement(hwnd, wndpl) As Boolean
|
---|
[1] | 219 | End Function
|
---|
| 220 |
|
---|
[178] | 221 | Const Function GetWindowRect(ByRef rc As RECT) As Boolean
|
---|
| 222 | Return _System_GetWindowRect(rc) As Boolean
|
---|
[1] | 223 | End Function
|
---|
| 224 |
|
---|
[192] | 225 | Const Function GetText(ps As PTSTR, maxCount As Long) As Boolean
|
---|
[178] | 226 | Return GetWindowText(ps, maxCount) As Boolean
|
---|
[1] | 227 | End Function
|
---|
| 228 |
|
---|
[77] | 229 | Const Function GetTextLength() As Long
|
---|
[1] | 230 | Return GetWindowTextLength(hwnd)
|
---|
| 231 | End Function
|
---|
| 232 |
|
---|
[77] | 233 | Const Function GetWindowThreadId() As DWord
|
---|
[1] | 234 | Return GetWindowProcessThreadId(hwnd, 0)
|
---|
| 235 | End Function
|
---|
| 236 |
|
---|
[77] | 237 | Const Function GetWindowProcessThreadId(ByRef processId As DWord) As DWord
|
---|
[192] | 238 | Return GetWindowProcessThreadId(hwnd, VarPtr(processId))
|
---|
[1] | 239 | End Function
|
---|
| 240 |
|
---|
[178] | 241 | Function HideCaret() As Boolean
|
---|
| 242 | Return _System_HideCaret(hwnd) As Boolean
|
---|
[1] | 243 | End Function
|
---|
| 244 |
|
---|
[178] | 245 | Function InvalidateRect(ByRef rc As RECT, erace As Boolean) As Boolean
|
---|
| 246 | Return _System_InvalidateRect(hwnd, rc, erace) As Boolean
|
---|
[1] | 247 | End Function
|
---|
| 248 |
|
---|
[178] | 249 | Function InvalidateRect(ByRef rc As RECT) As Boolean
|
---|
| 250 | Return _System_InvalidateRect(hwnd, rc, TRUE) As Boolean
|
---|
[1] | 251 | End Function
|
---|
| 252 |
|
---|
[178] | 253 | Function InvalidateRgn(hrgn As HRGN, erace As Boolean) As Boolean
|
---|
| 254 | Return _System_InvalidateRgn(hwnd, hrgn, erace) As Boolean
|
---|
[1] | 255 | End Function
|
---|
| 256 |
|
---|
[178] | 257 | Function InvalidateRgn(hrgn As HRGN) As Boolean
|
---|
| 258 | Return _System_InvalidateRgn(hwnd, hrgn, TRUE) As Boolean
|
---|
[1] | 259 | End Function
|
---|
| 260 |
|
---|
[178] | 261 | Function Invalidate(erace As Boolean) As Boolean
|
---|
| 262 | Return _System_InvalidateRect(hwnd, ByVal 0, erace) As Boolean
|
---|
[1] | 263 | End Function
|
---|
[42] | 264 |
|
---|
[178] | 265 | Function Invalidate() As Boolean
|
---|
| 266 | Return _System_InvalidateRect(hwnd, ByVal 0, TRUE) As Boolean
|
---|
[1] | 267 | End Function
|
---|
| 268 |
|
---|
[178] | 269 | Const Function IsChild(hwnd As HWND) As Boolean
|
---|
| 270 | Return IsChild(This.hwnd, hwnd) As Boolean
|
---|
[1] | 271 | End Function
|
---|
| 272 |
|
---|
[178] | 273 | Const Function IsDialogMessage(ByRef msg As MSG) As Boolean
|
---|
| 274 | Return IsDialogMessage(hwnd, msg) As Boolean
|
---|
[1] | 275 | End Function
|
---|
| 276 |
|
---|
[178] | 277 | Const Function IsIconic() As Boolean
|
---|
| 278 | Return _System_IsIconic(hwnd) As Boolean
|
---|
[1] | 279 | End Function
|
---|
| 280 |
|
---|
[178] | 281 | Const Function IsWindow() As Boolean
|
---|
| 282 | Return _System_IsWindow(hwnd) As Boolean
|
---|
[1] | 283 | End Function
|
---|
| 284 |
|
---|
[178] | 285 | Const Function IsEnabled() As Boolean
|
---|
| 286 | Return IsWindowEnabled(hwnd) As Boolean
|
---|
[1] | 287 | End Function
|
---|
| 288 |
|
---|
[178] | 289 | Const Function IsUnicode() As Boolean
|
---|
| 290 | Return IsWindowUnicode(hwnd) As Boolean
|
---|
[1] | 291 | End Function
|
---|
| 292 |
|
---|
[178] | 293 | Const Function IsVisible() As Boolean
|
---|
| 294 | Return IsWindowVisible(hwnd) As Boolean
|
---|
[1] | 295 | End Function
|
---|
| 296 |
|
---|
[178] | 297 | Const Function IsZoomed() As Boolean
|
---|
| 298 | Return IsZoomed(hwnd) As Boolean
|
---|
[1] | 299 | End Function
|
---|
| 300 |
|
---|
[178] | 301 | Function KillTimer(idEvent As ULONG_PTR) As Boolean
|
---|
| 302 | Return KillTimer(idEvent) As Boolean
|
---|
[1] | 303 | End Function
|
---|
| 304 |
|
---|
[178] | 305 | Function LockUpdate() As Boolean
|
---|
| 306 | Return LockWindowUpdate(hwnd) As Boolean
|
---|
[1] | 307 | End Function
|
---|
| 308 |
|
---|
| 309 | Function MapPoints(hwndTo As HWND, pPoints As *POINTAPI, cPoints As DWord) As Long
|
---|
| 310 | Return MapWindowPoints(hwnd, hwndTo, pPoints, cPoints)
|
---|
| 311 | End Function
|
---|
| 312 |
|
---|
| 313 | Function MapPoints(hwndTo As HWND, ByRef rc As RECT) As Long
|
---|
| 314 | Return MapWindowPoints(hwnd, hwndTo, VarPtr(rc) As *POINTAPI, 2)
|
---|
| 315 | End Function
|
---|
| 316 |
|
---|
[192] | 317 | Const Function MessageBox(text As PCTSTR, caption As PCTSTR, uType As DWord) As Long
|
---|
[1] | 318 | Return MessageBox(hwnd, text, caption, uType)
|
---|
| 319 | End Function
|
---|
| 320 |
|
---|
[192] | 321 | Const Function MessageBox(text As PCTSTR, caption As PCTSTR) As Long
|
---|
[1] | 322 | Return MessageBox(hwnd, text, caption, MB_OK)
|
---|
| 323 | End Function
|
---|
| 324 |
|
---|
[192] | 325 | Const Function MessageBox(text As PCTSTR) As Long
|
---|
[1] | 326 | Return MessageBox(hwnd, text, 0, MB_OK)
|
---|
| 327 | End Function
|
---|
| 328 |
|
---|
[178] | 329 | Function Move(x As Long, y As Long, width As Long, height As Long, repaint As Boolean) As Boolean
|
---|
| 330 | Return MoveWindow(hwnd, x, y, width, height, repaint) As Boolean
|
---|
[1] | 331 | End Function
|
---|
| 332 |
|
---|
[178] | 333 | Function Move(x As Long, y As Long, width As Long, height As Long) As Boolean
|
---|
| 334 | Return MoveWindow(hwnd, x, y, width, height, TRUE) As Boolean
|
---|
[1] | 335 | End Function
|
---|
| 336 |
|
---|
[178] | 337 | Function Move(ByRef rc As RECT, repeaint As Boolean) As Boolean
|
---|
[1] | 338 | With rc
|
---|
[178] | 339 | Return MoveWindow(hwnd, .left, .top, .right - .left, .bottom - .top, repaint) As Boolean
|
---|
[1] | 340 | End With
|
---|
| 341 | End Function
|
---|
| 342 |
|
---|
[178] | 343 | Function Move(ByRef rc As RECT) As Boolean
|
---|
[1] | 344 | With rc
|
---|
[178] | 345 | Return MoveWindow(hwnd, .left, .top, .right - .left, .bottom - .top, TRUE) As Boolean
|
---|
[1] | 346 | End With
|
---|
| 347 | End Function
|
---|
| 348 |
|
---|
[178] | 349 | Function OpenClipboard() As Boolean
|
---|
| 350 | Return OpenClipboard(hwnd) As Boolean
|
---|
[1] | 351 | End Function
|
---|
| 352 |
|
---|
[178] | 353 | Function OpenIcon() As Boolean
|
---|
| 354 | Return OpenIcon(hwnd) As Boolean
|
---|
[1] | 355 | End Function
|
---|
| 356 |
|
---|
[178] | 357 | Function PostMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As Boolean
|
---|
| 358 | Return PostMessage(hwnd, msg, wp, lp) As Boolean
|
---|
[1] | 359 | End Function
|
---|
| 360 |
|
---|
[178] | 361 | Function PostMessage(msg As DWord) As Boolean
|
---|
| 362 | Return PostMessage(hwnd, msg, 0, 0) As Boolean
|
---|
[1] | 363 | End Function
|
---|
| 364 |
|
---|
[178] | 365 | Function RedrawWindow(ByRef rcUpdate As RECT, hrgnUpdate As HRGN, flags As DWord) As Boolean
|
---|
| 366 | Return RedrawWindow(hwnd, rcUpdatre, hrgnUpdate, flags) As Boolean
|
---|
[1] | 367 | End Function
|
---|
| 368 |
|
---|
[178] | 369 | Function ReleaseDC(hdc As HDC) As Boolean
|
---|
| 370 | Return ReleaseDC(hwnd, hdc) As Boolean
|
---|
[1] | 371 | End Function
|
---|
| 372 |
|
---|
[192] | 373 | Function RemoveProp(str As String) As HANDLE
|
---|
| 374 | Return RemoveProp(hwnd, ToTCStr(str))
|
---|
| 375 | End Function
|
---|
| 376 |
|
---|
| 377 | Function RemoveProp(psz As PCTSTR) As HANDLE
|
---|
[1] | 378 | Return RemoveProp(hwnd, psz)
|
---|
| 379 | End Function
|
---|
| 380 |
|
---|
| 381 | Function RemoveProp(atom As ATOM) As HANDLE
|
---|
[192] | 382 | Return RemoveProp(hwnd, atom As ULONG_PTR As PCTSTR)
|
---|
[1] | 383 | End Function
|
---|
| 384 |
|
---|
[178] | 385 | Const Function ScreenToClient(ByRef pt As POINTAPI) As Boolean
|
---|
| 386 | Return _System_ScreenToClient(hwnd, pt) As Boolean
|
---|
[1] | 387 | End Function
|
---|
| 388 |
|
---|
[223] | 389 | Const Function ScreenToClient(ByRef rc As RECT) As Boolean
|
---|
| 390 | Dim ppt = VarPtr(rc) As *POINTAPI
|
---|
[237] | 391 | Return (_System_ScreenToClient(hwnd, ppt[0]) <> FALSE And _System_ScreenToClient(hwnd, ppt[1]) <> FALSE) As Boolean
|
---|
[223] | 392 | End Function
|
---|
| 393 |
|
---|
[178] | 394 | Function Scroll(dx As Long, dy As Long, ByRef rcScroll As RECT, ByRef rcClip As RECT, hrgnUpdate As HRGN, ByRef rcUpdate As RECT, flags As DWord) As Boolean
|
---|
| 395 | Return ScrollWindowEx(hwnd, dx, dy, rcScroll, rcClip, hrgnUpdate, rcUpdate, flags) As Boolean
|
---|
[1] | 396 | End Function
|
---|
| 397 |
|
---|
| 398 | Function SendDlgItemMessage(idDlgItem As Long, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
|
---|
| 399 | Return SendDlgItemMessage(hwnd, idDlgItem, wp, lp)
|
---|
| 400 | End Function
|
---|
| 401 |
|
---|
| 402 | Function SendDlgItemMessage(idDlgItem As Long, msg As DWord) As LRESULT
|
---|
| 403 | Return SendDlgItemMessage(hwnd, idDlgItem, 0, 0)
|
---|
| 404 | End Function
|
---|
| 405 |
|
---|
| 406 | Function SendMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
|
---|
| 407 | Return SendMessage(hwnd, msg, wp, lp)
|
---|
| 408 | End Function
|
---|
| 409 |
|
---|
| 410 | Function SendMessage(msg As DWord) As LRESULT
|
---|
| 411 | Return SendMessage(hwnd, msg, 0, 0)
|
---|
| 412 | End Function
|
---|
| 413 |
|
---|
[208] | 414 | Function SetActiveWindow() As WindowHandle
|
---|
| 415 | Return New WindowHandle(SetActiveWindow(hwnd))
|
---|
[1] | 416 | End Function
|
---|
| 417 |
|
---|
[192] | 418 | Function SetDlgItemText(idDlgItem As Long, psz As PCTSTR) As Boolean
|
---|
[178] | 419 | Return SetDlgItemText(hwnd, idDlgItem, psz) As Boolean
|
---|
[1] | 420 | End Function
|
---|
[42] | 421 |
|
---|
[208] | 422 | Function SetCapture() As WindowHandle
|
---|
| 423 | Return New WindowHandle(SetCapture(hwnd))
|
---|
[1] | 424 | End Function
|
---|
| 425 |
|
---|
| 426 | Function SetClassLongPtr(index As Long, newLong As LONG_PTR) As LONG_PTR
|
---|
[272] | 427 | Return _System_SetClassLongPtr(hwnd, index, newLong)
|
---|
[1] | 428 | End Function
|
---|
| 429 |
|
---|
[208] | 430 | Function SetFocus() As WindowHandle
|
---|
| 431 | Return New WindowHandle(SetFocus(hwnd))
|
---|
[1] | 432 | End Function
|
---|
| 433 |
|
---|
[178] | 434 | Function SetForeground() As Boolean
|
---|
| 435 | Return SetForegroundWindow(hwnd) As Boolean
|
---|
[1] | 436 | End Function
|
---|
| 437 |
|
---|
[178] | 438 | Function SetMenu(hmenu As HMENU) As Boolean
|
---|
| 439 | Return _System_SetMenu(hwnd, hmenu) As Boolean
|
---|
[1] | 440 | End Function
|
---|
| 441 |
|
---|
[208] | 442 | Function SetParent(hwndNewParent As HWND) As WindowHandle
|
---|
| 443 | Return New WindowHandle(_System_SetParent(hwnd, hwndNewParent))
|
---|
[1] | 444 | End Function
|
---|
| 445 |
|
---|
[192] | 446 | Function SetProp(str As String, hData As HANDLE) As Boolean
|
---|
[272] | 447 | Return _System_SetProp(hwnd, ToTCStr(str), hData) As Boolean
|
---|
[192] | 448 | End Function
|
---|
| 449 |
|
---|
| 450 | Function SetProp(psz As PCTSTR, hData As HANDLE) As Boolean
|
---|
[272] | 451 | Return _System_SetProp(hwnd, psz, hData) As Boolean
|
---|
[1] | 452 | End Function
|
---|
| 453 |
|
---|
[178] | 454 | Function SetProp(atom As ATOM, hData As HANDLE) As Boolean
|
---|
[272] | 455 | Return SetProp((atom As ULONG_PTR) As PCTSTR, hData) As Boolean
|
---|
[1] | 456 | End Function
|
---|
| 457 |
|
---|
[178] | 458 | Function SetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO, redraw As Boolean) As Boolean
|
---|
[272] | 459 | Return _System_SetScrollInfo(hwnd, fnBar, si, redraw) As Boolean
|
---|
[1] | 460 | End Function
|
---|
| 461 |
|
---|
[178] | 462 | Function SetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO) As Boolean
|
---|
[272] | 463 | Return _System_SetScrollInfo(hwnd, fnBar, si, TRUE) As Boolean
|
---|
[1] | 464 | End Function
|
---|
| 465 |
|
---|
| 466 | Function SetTimer(idEvent As ULONG_PTR, elapse As DWord, timerFunc As TIMERPROC) As ULONG_PTR
|
---|
| 467 | Return SetTmer(hwnd, idEvent, elapse, timerFunc)
|
---|
| 468 | End Function
|
---|
| 469 |
|
---|
| 470 | Function SetTimer(idEvent As ULONG_PTR, elapse As DWord) As ULONG_PTR
|
---|
| 471 | Return SetTmer(hwnd, idEvent, elapse, 0)
|
---|
| 472 | End Function
|
---|
| 473 |
|
---|
[178] | 474 | Function SetContextHelpId(contextHelpId As DWord) As Boolean
|
---|
| 475 | Return SetContextHelpId(hwnd, contextHelpId) As Boolean
|
---|
[1] | 476 | End Function
|
---|
| 477 |
|
---|
| 478 | Function SetWindowLongPtr(index As Long, newLong As LONG_PTR) As LONG_PTR
|
---|
[77] | 479 | Return _System_SetWindowLongPtr(hwnd, index, newLong)
|
---|
[1] | 480 | End Function
|
---|
| 481 |
|
---|
[178] | 482 | Function SetWindowPlacement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
|
---|
| 483 | Return SetWindowPlacement(hwnd, wndpl) As Boolean
|
---|
[1] | 484 | End Function
|
---|
| 485 |
|
---|
[178] | 486 | Function SetPos(hwndInsertAfter As HWND, x As Long, y As Long, cx As Long, cy As Long, flags As DWord) As Boolean
|
---|
| 487 | Return SetWindowPos(hwnd, hwndInsertAfter, x, y, cx, cy, flags) As Boolean
|
---|
[1] | 488 | End Function
|
---|
| 489 |
|
---|
[178] | 490 | Function SetPos(hwndInsertAfter As HWND, ByRef rc As RECT, flags As DWord) As Boolean
|
---|
[1] | 491 | With rc
|
---|
[178] | 492 | Return SetWindowPos(hwnd, hwndInsertAfter, .left, .top, .right - .left, .bottom - .top, flags) As Boolean
|
---|
[1] | 493 | End With
|
---|
| 494 | End Function
|
---|
| 495 |
|
---|
[178] | 496 | Function SetRgn(hrgn As HRGN, redraw As Boolean) As Boolean
|
---|
| 497 | Return SetWindowRgn(hwnd, hrgn, redraw) As Boolean
|
---|
[1] | 498 | End Function
|
---|
| 499 |
|
---|
[178] | 500 | Function SetRgn(hrgn As HRGN) As Boolean
|
---|
| 501 | Return SetWindowRgn(hwnd, hrgn, TRUE) As Boolean
|
---|
[1] | 502 | End Function
|
---|
| 503 |
|
---|
[192] | 504 | Function SetText(psz As PCTSTR) As Boolean
|
---|
[178] | 505 | Return SetWindowText(hwnd, psz) As Boolean
|
---|
[1] | 506 | End Function
|
---|
| 507 |
|
---|
[192] | 508 | Function SetText(str As String) As Boolean
|
---|
| 509 | Return SetWindowText(hwnd, ToTCStr(str)) As Boolean
|
---|
| 510 | End Function
|
---|
| 511 |
|
---|
[178] | 512 | Function ShowCaret() As Boolean
|
---|
| 513 | Return _System_ShowCaret(hwnd) As Boolean
|
---|
[77] | 514 | End Function
|
---|
| 515 |
|
---|
[178] | 516 | Function ShowScrollBar(bar As DWord, show As Boolean) As Boolean
|
---|
| 517 | Return ShowScrollBar(hwnd, bar, show) As Boolean
|
---|
[1] | 518 | End Function
|
---|
| 519 |
|
---|
[178] | 520 | Function ShowScrollBar(bar As DWord) As Boolean
|
---|
| 521 | Return ShowScrollBar(hwnd, bar, TRUE) As Boolean
|
---|
[1] | 522 | End Function
|
---|
| 523 |
|
---|
[178] | 524 | Function Show(cmdShow As DWord) As Boolean
|
---|
| 525 | Return ShowWindow(hwnd, cmdShow) As Boolean
|
---|
[1] | 526 | End Function
|
---|
| 527 |
|
---|
[178] | 528 | Function ShowAsync(cmdShow As DWord) As Boolean
|
---|
| 529 | Return ShowWindowAsync(hwnd, cmdShow) As Boolean
|
---|
[1] | 530 | End Function
|
---|
| 531 |
|
---|
[178] | 532 | Function Update() As Boolean
|
---|
| 533 | Return UpdateWindow(hwnd) As Boolean
|
---|
[1] | 534 | End Function
|
---|
| 535 |
|
---|
[178] | 536 | Function ValidateRect(ByRef rc As RECT) As Boolean
|
---|
| 537 | Return _System_ValidateRect(hwnd, rc) As Boolean
|
---|
[1] | 538 | End Function
|
---|
| 539 |
|
---|
[178] | 540 | Function ValidateRgn(hrgn As HRGN) As Boolean
|
---|
| 541 | Return _System_ValidateRgn(hwnd, hrgn) As Boolean
|
---|
[1] | 542 | End Function
|
---|
| 543 |
|
---|
[178] | 544 | Function Validate() As Boolean
|
---|
| 545 | Return _System_ValidateRect(hwnd, ByVal 0) As Boolean
|
---|
[1] | 546 | End Function
|
---|
| 547 |
|
---|
| 548 | ' Get/SetWindowLongPtr Wrappers
|
---|
| 549 |
|
---|
[77] | 550 | Const Function GetExStyle() As DWord
|
---|
| 551 | Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
|
---|
[1] | 552 | End Function
|
---|
| 553 |
|
---|
[77] | 554 | Const Function GetStyle() As DWord
|
---|
| 555 | Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
|
---|
[1] | 556 | End Function
|
---|
| 557 |
|
---|
[77] | 558 | Const Function GetWndProc() As WNDPROC
|
---|
| 559 | Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As WNDPROC
|
---|
[1] | 560 | End Function
|
---|
| 561 |
|
---|
[77] | 562 | Const Function GetInstance() As HINSTANCE
|
---|
| 563 | Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
|
---|
[1] | 564 | End Function
|
---|
| 565 |
|
---|
[77] | 566 | Const Function GetUserData() As LONG_PTR
|
---|
| 567 | Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)
|
---|
[1] | 568 | End Function
|
---|
| 569 |
|
---|
| 570 | Function SetExStyle(style As DWord) As DWord
|
---|
[77] | 571 | Return _System_SetWindowLongPtr(hwnd, GWL_EXSTYLE, style) As DWord
|
---|
[1] | 572 | End Function
|
---|
| 573 |
|
---|
| 574 | Function SetStyle(style As DWord) As DWord
|
---|
[77] | 575 | Return _System_SetWindowLongPtr(hwnd, GWL_STYLE, style) As DWord
|
---|
[1] | 576 | End Function
|
---|
| 577 |
|
---|
| 578 | Function SetWndProc(wndProc As WNDPROC) As WNDPROC
|
---|
[77] | 579 | Return _System_SetWindowLongPtR(hwnd, GWLP_WNDPROC, wndProc As WNDPROC) As WNDPROC
|
---|
[1] | 580 | End Function
|
---|
| 581 |
|
---|
| 582 | Function SetUserData(value As LONG_PTR) As LONG_PTR
|
---|
[77] | 583 | Return _System_SetWindowLongPtr(value As LONG_PTR)
|
---|
[1] | 584 | End Function
|
---|
| 585 |
|
---|
| 586 | ' Propaties
|
---|
| 587 |
|
---|
[77] | 588 | Const Function ClientRect() As RECT
|
---|
[1] | 589 | Dim rc As RECT
|
---|
[77] | 590 | _System_GetClientRect(hwnd, rc)
|
---|
[1] | 591 | Return rc
|
---|
| 592 | End Function
|
---|
| 593 |
|
---|
| 594 | Sub ClientRect(ByRef rc As RECT)
|
---|
| 595 | Dim hasMenu As BOOL
|
---|
[178] | 596 | If IsChild() = False And IsMenu() <> False Then
|
---|
[1] | 597 | hasMenu = TRUE
|
---|
| 598 | Else
|
---|
| 599 | hasMenu = FALSE
|
---|
[178] | 600 | End If
|
---|
[1] | 601 | AdjustWindowRectEx(rc, GetStyle(), hasMenu, GetExStyle())
|
---|
| 602 | MoveWindow(rc) ' WindowRect = rc
|
---|
| 603 | End Sub
|
---|
| 604 |
|
---|
[77] | 605 | Const Function WindowRect() As RECT
|
---|
[1] | 606 | Dim rc As RECT
|
---|
[77] | 607 | _System_GetWindowRect(hwnd, rc)
|
---|
[1] | 608 | Return rc
|
---|
| 609 | End Function
|
---|
| 610 |
|
---|
| 611 | Sub WindowRect(ByRef rc As RECT)
|
---|
| 612 | MoveWindow(rc)
|
---|
| 613 | End Sub
|
---|
| 614 |
|
---|
[77] | 615 | Const Function ContextHelpID() As DWord
|
---|
[1] | 616 | Return GetContextHelpId(hwnd)
|
---|
| 617 | End Function
|
---|
| 618 |
|
---|
| 619 | Sub ContextHelpID(newID As DWord)
|
---|
[77] | 620 | _System_SetContextHelpId(hwnd, newId)
|
---|
[1] | 621 | End Sub
|
---|
| 622 |
|
---|
[77] | 623 | Const Function DlgCtrlID() As Long
|
---|
[1] | 624 | Return GetDlgCtrlID(hwnd)
|
---|
| 625 | End Function
|
---|
| 626 |
|
---|
| 627 | Sub DlgCtrlId(newId As Long)
|
---|
[77] | 628 | _System_SetWindowLongPtr(hwnd, GWLP_ID, newId)
|
---|
[1] | 629 | End Sub
|
---|
| 630 |
|
---|
| 631 | Function DlgItem(idDlgItem As Long) As WindowHandle
|
---|
[77] | 632 | Dim w As WindowHandle(GetDlgItem(hwnd, idDlgItem))
|
---|
| 633 | Return w
|
---|
[1] | 634 | End Function
|
---|
| 635 |
|
---|
[77] | 636 | Const Function ExStyle() As DWord
|
---|
| 637 | Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
|
---|
[1] | 638 | End Function
|
---|
| 639 |
|
---|
| 640 | Sub ExStyle(newExStyle As DWord)
|
---|
[77] | 641 | _System_SetWindowLongPtr(hwnd, GWLP_EXSTYLE, newExStyle)
|
---|
[1] | 642 | End Sub
|
---|
| 643 |
|
---|
[77] | 644 | Const Function Style() As DWord
|
---|
| 645 | Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
|
---|
[1] | 646 | End Function
|
---|
| 647 |
|
---|
[223] | 648 | Sub Style(newStyle As DWord)
|
---|
[77] | 649 | _System_SetWindowLongPtr(hwnd, GWLP_STYLE, newStyle)
|
---|
[1] | 650 | End Sub
|
---|
| 651 |
|
---|
[178] | 652 | Const Function Enabled() As Boolean
|
---|
| 653 | Return IsWindowEnabled(hwnd) As Boolean
|
---|
[1] | 654 | End Function
|
---|
| 655 |
|
---|
[178] | 656 | Sub Enabled(enable As Boolean)
|
---|
[1] | 657 | EnableWindow(hwnd, enable)
|
---|
| 658 | End Sub
|
---|
| 659 |
|
---|
[77] | 660 | Const Function Font() As HFONT
|
---|
[1] | 661 | Return SendMessage(hwnd, WM_GETFONT, 0, 0) As HFONT
|
---|
| 662 | End Function
|
---|
| 663 |
|
---|
| 664 | Sub Font(hfntNew As HFONT)
|
---|
| 665 | SendMessage(hwnd, WM_SETFONT, hfntNew As WPARAM, TRUE)
|
---|
| 666 | End Sub
|
---|
| 667 |
|
---|
[178] | 668 | Const Function Maximized() As Boolean
|
---|
[272] | 669 | Return IsIconic() As Boolean
|
---|
[1] | 670 | End Function
|
---|
| 671 |
|
---|
[178] | 672 | Sub Maximized(maximized As Boolean)
|
---|
| 673 | If maximized <> False Then
|
---|
[1] | 674 | ShowWindow(hwnd, SW_SHOWMAXIMIZED)
|
---|
| 675 | Else
|
---|
| 676 | ShowWindow(hwnd, SW_RESTORE)
|
---|
| 677 | End If
|
---|
| 678 | End Sub
|
---|
| 679 |
|
---|
[178] | 680 | Const Function Minimized() As Boolean
|
---|
| 681 | Return IsIconic(hwnd) As Boolean
|
---|
[1] | 682 | End Function
|
---|
| 683 |
|
---|
[178] | 684 | Sub Minimized(minimized As Boolean)
|
---|
| 685 | If minimized <> False Then
|
---|
[1] | 686 | CloseWindow(hwnd)
|
---|
| 687 | Else
|
---|
| 688 | OpenIcon(hwnd)
|
---|
| 689 | End If
|
---|
| 690 | End Sub
|
---|
| 691 |
|
---|
[77] | 692 | Const Function Instance() As HINSTANCE
|
---|
| 693 | Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
|
---|
[1] | 694 | End Function
|
---|
| 695 |
|
---|
| 696 | ' IsWindow, IsUnicodeはメソッドと同じ。
|
---|
| 697 |
|
---|
[77] | 698 | Const Function Parent() As WindowHandle
|
---|
[223] | 699 | Return New WindowHandle(_System_GetParent(hwnd))
|
---|
[1] | 700 | End Function
|
---|
| 701 |
|
---|
| 702 | Sub Parent(hwndNewParent As HWND)
|
---|
[77] | 703 | _System_SetParent(hwnd, hwndNewParent)
|
---|
[1] | 704 | End Sub
|
---|
| 705 |
|
---|
[77] | 706 | Const Function ProcessID() As DWord
|
---|
[1] | 707 | GetWindowProcessThreadId(ProcessID)
|
---|
| 708 | End Function
|
---|
| 709 |
|
---|
[77] | 710 | Const Function ThreadID() As DWord
|
---|
[1] | 711 | Return GetWindowProcessThreadId(ByVal 0)
|
---|
| 712 | End Function
|
---|
| 713 |
|
---|
[77] | 714 | Const Function Menu() As HMENU
|
---|
| 715 | Return _System_GetMenu(hwnd)
|
---|
[1] | 716 | End Function
|
---|
| 717 |
|
---|
| 718 | Sub Menu(hmenuNew As HMENU)
|
---|
[77] | 719 | _System_SetMenu(hwnd, hmenuNew)
|
---|
[1] | 720 | End Sub
|
---|
| 721 |
|
---|
[192] | 722 | Const Function Prop(str As String) As HANDLE
|
---|
| 723 | Return GetProp(str)
|
---|
| 724 | End Function
|
---|
| 725 |
|
---|
| 726 | Const Function Prop(psz As PCTSTR) As HANDLE
|
---|
| 727 | Return GetProp(psz)
|
---|
| 728 | End Function
|
---|
| 729 |
|
---|
| 730 | Const Function Prop(atom As ATOM) As HANDLE
|
---|
| 731 | Return GetProp(atom)
|
---|
| 732 | End Function
|
---|
| 733 |
|
---|
| 734 | Sub Prop(str As PCTSTR, h As HANDLE)
|
---|
| 735 | SetProp(str, h)
|
---|
| 736 | End Sub
|
---|
| 737 |
|
---|
| 738 | Sub Prop(atom As ATOM, h As HANDLE)
|
---|
| 739 | SetProp(atom, h)
|
---|
| 740 | End Sub
|
---|
| 741 |
|
---|
[77] | 742 | Const Function Text() As String
|
---|
[192] | 743 | Dim size = GetWindowTextLength(hwnd) + 1
|
---|
[272] | 744 | Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PTSTR
|
---|
[192] | 745 | Dim length = GetWindowText(hwnd, p, size)
|
---|
[272] | 746 | Text = New String(p, length As Long)
|
---|
[1] | 747 | End Function
|
---|
| 748 |
|
---|
[192] | 749 | Sub Text(newText As String)
|
---|
| 750 | SetWindowText(hwnd, ToTCStr(newText))
|
---|
| 751 | End Sub
|
---|
| 752 |
|
---|
| 753 | Sub Text(newText As PCTSTR)
|
---|
[1] | 754 | SetWindowText(hwnd, newText)
|
---|
| 755 | End Sub
|
---|
| 756 |
|
---|
[77] | 757 | Const Function TextLength() As Long
|
---|
[1] | 758 | Return GetWindowTextLength(hwnd)
|
---|
| 759 | End Function
|
---|
| 760 |
|
---|
[77] | 761 | Const Function UserData() As LONG_PTR
|
---|
| 762 | Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)
|
---|
[1] | 763 | End Function
|
---|
| 764 |
|
---|
| 765 | Sub UserData(newValue As LONG_PTR)
|
---|
[77] | 766 | _System_SetWindowLongPtr(hwnd, GWLP_USERDATA, newValue)
|
---|
[1] | 767 | End Sub
|
---|
| 768 |
|
---|
[178] | 769 | Const Function Visible() As Boolean
|
---|
| 770 | Return IsVisible(hwnd) As Boolean
|
---|
[1] | 771 | End Function
|
---|
| 772 |
|
---|
[178] | 773 | Sub Visible(visible As Boolean)
|
---|
| 774 | If visible <> False Then
|
---|
[1] | 775 | ShowWindow(hwnd, SW_SHOW)
|
---|
| 776 | Else
|
---|
| 777 | ShowWindow(hwnd, SW_HIDE)
|
---|
| 778 | EndIf
|
---|
| 779 | End Sub
|
---|
| 780 |
|
---|
[77] | 781 | Const Function WindowPlacement() As WINDOWPLACEMENT
|
---|
[1] | 782 | WindowPlacement.length = Len(WindowPlacement)
|
---|
| 783 | GetWindowPlacement(hwnd, WindowPlacement)
|
---|
| 784 | End Function
|
---|
| 785 |
|
---|
| 786 | Sub WindowPlacement(ByRef wndpl As WINDOWPLACEMENT)
|
---|
| 787 | SetWindowPlacement(wndpl)
|
---|
| 788 | End Sub
|
---|
| 789 |
|
---|
[77] | 790 | Const Function WndProc() As WNDPROC
|
---|
| 791 | Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As WNDPROC
|
---|
[1] | 792 | End Function
|
---|
| 793 |
|
---|
| 794 | Sub WndProc(newWndProc As WNDPROC)
|
---|
[77] | 795 | _System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, newWndProc As LONG_PTR)
|
---|
[1] | 796 | End Sub
|
---|
| 797 |
|
---|
| 798 | Protected
|
---|
| 799 | Sub SetHWnd(hwndNew As HWND)
|
---|
| 800 | hwnd = hwndNew
|
---|
| 801 | End Sub
|
---|
| 802 | End Class
|
---|
| 803 |
|
---|
[192] | 804 | #endif '__WINDOWS_WINDOWHANDLE_SBP__
|
---|