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