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