[545] | 1 | 'Classes/ActiveBasic/Windows/UI/WindowHandle.sbp
|
---|
[208] | 2 |
|
---|
[77] | 3 | #ifdef _WIN64
|
---|
[272] | 4 | Declare Function _System_GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
|
---|
| 5 | Declare Function _System_SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLongPtr (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
|
---|
[192] | 6 | Declare Function _System_GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
|
---|
| 7 | Declare Function _System_SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLongPtr (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
|
---|
[77] | 8 | #else
|
---|
[272] | 9 | Declare Function _System_GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLong (hWnd As HWND, nIndex As Long) As LONG_PTR
|
---|
| 10 | Declare Function _System_SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLong (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
|
---|
[192] | 11 | Declare Function _System_GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLong (hWnd As HWND, nIndex As Long) As LONG_PTR
|
---|
| 12 | Declare Function _System_SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLong (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
|
---|
[77] | 13 | #endif
|
---|
| 14 | Declare Function _System_GetParent Lib "user32" Alias "GetParent" (hWnd As HWND) As HWND
|
---|
[303] | 15 | Declare Function _System_SetParent Lib "user32" Alias "SetParent" (hWnd As HWND, hwndParent As HWND) As HWND
|
---|
[77] | 16 | Declare Function _System_GetMenu Lib "user32" Alias "GetMenu" (hWnd As HWND) As HMENU
|
---|
[303] | 17 | Declare Function _System_SetMenu Lib "user32" Alias "SetMenu" (hWnd As HWND, hmenu As HMENU) As HMENU
|
---|
[77] | 18 | Declare Function _System_InvalidateRect Lib "user32" Alias "InvalidateRect" (hWnd As HWND, ByRef Rect As RECT, bErase As BOOL) As BOOL
|
---|
| 19 | Declare Function _System_InvalidateRgn Lib "user32" Alias "InvalidateRgn" (hWnd As HWND, hRgn As HRGN, bErase As BOOL) As BOOL
|
---|
| 20 | Declare Function _System_ValidateRect Lib "user32" Alias "ValidateRect" (hWnd As HWND, ByRef Rect As RECT) As BOOL
|
---|
| 21 | Declare Function _System_ValidateRgn Lib "user32" Alias "ValidateRgn" (hWnd As HWND, hRgn As HRGN) As BOOL
|
---|
| 22 | Declare Function _System_BeginPaint Lib "user32" Alias "BeginPaint" (hWnd As HWND, ByRef ps As PAINTSTRUCT) As HDC
|
---|
[192] | 23 | Declare Function _System_EndPaint Lib "user32" Alias "EndPaint" (hWnd As HWND, ByRef ps As PAINTSTRUCT) As HDC
|
---|
| 24 | Declare Function _System_ClientToScreen Lib "user32" Alias "ClientToScreen" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
|
---|
| 25 | Declare Function _System_ScreenToClient Lib "user32" Alias "ScreenToClient" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
|
---|
[77] | 26 | Declare Function _System_CreateCaret Lib "user32" Alias "CreateCaret" (hWnd As HWND, hBitmap As HBITMAP, nWidth As Long, nHeight As Long) As BOOL
|
---|
| 27 | Declare Function _System_HideCaret Lib "user32" Alias "HideCaret" (hWnd As HWND) As BOOL
|
---|
| 28 | Declare Function _System_ShowCaret Lib "user32" Alias "ShowCaret" (hWnd As HWND) As BOOL
|
---|
| 29 | Declare Function _System_DrawMenuBar Lib "user32" Alias "DrawMenuBar" (hwnd As HWND) As BOOL
|
---|
| 30 | Declare Function _System_GetWindowRect Lib "user32" Alias "DrawMenuBar" (hWnd As HWND, ByRef Rect As RECT) As BOOL
|
---|
| 31 | Declare Function _System_IsWindow Lib "user32" Alias "IsWindow" (hWnd As HWND) As BOOL
|
---|
[303] | 32 | Declare Function _System_IsIconic Lib "user32" Alias "IsIconic" (hWnd As HWND) As BOOL
|
---|
[192] | 33 | Declare Function _System_GetClientRect Lib "user32" Alias "GetClientRect" (hWnd As HWND, ByRef Rect As RECT) As BOOL
|
---|
[272] | 34 | Declare Function _System_GetProp Lib "user32" Alias _FuncName_GetProp (hWnd As HWND, pString As PCTSTR) As HANDLE
|
---|
| 35 | Declare Function _System_SetProp Lib "user32" Alias _FuncName_SetProp (hWnd As HWND, pString As PCTSTR, hData As HANDLE) As BOOL
|
---|
| 36 | Declare Function _System_GetClassName Lib "user32" Alias _FuncName_GetClassName (hWnd As HWND, lpClassName As PTSTR, nMaxCount As Long) As Long
|
---|
| 37 | Declare Function _System_GetScrollInfo Lib "user32" Alias "GetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO) As BOOL
|
---|
| 38 | Declare Function _System_SetScrollInfo Lib "user32" Alias "SetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO, bRedraw As Long) As BOOL
|
---|
| 39 | Declare Function _System_GetSystemMenu Lib "user32" Alias "GetSystemMenu" (hWnd As HWND, bRevert As BOOL) As HMENU
|
---|
[303] | 40 | Declare Function _System_GetDC Lib "user32" Alias "GetDC" (hwnd As HWND) As HDC
|
---|
| 41 | Declare Function _System_GetDCEx Lib "user32" Alias "GetDCEx" (hwnd As HWND, hrgnClip As HRGN, flags As DWord) As HDC
|
---|
| 42 | Declare Function _System_GetWindowDC Lib "user32" Alias "GetWindowDC" (hwnd As HWND) As HDC
|
---|
| 43 | Declare Function _System_ReleaseDC Lib "user32" Alias "ReleaseDC" (hwnd As HWND, hdc As HDC) As BOOL
|
---|
| 44 | Declare Function _System_SendMessage Lib "user32" Alias _FuncName_SendMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
|
---|
| 45 | Declare Function _System_PostMessage Lib "user32" Alias _FuncName_PostMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
|
---|
| 46 | Declare Function _System_SendDlgItemMessage Lib "user32" Alias _FuncName_SendDlgItemMessage (hwnd As HWND, id As DWord, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
|
---|
| 47 | Declare Function _System_GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (hwnd As HWND, pdwProcessId As *DWord) As DWord
|
---|
[77] | 48 |
|
---|
[303] | 49 | Namespace ActiveBasic
|
---|
| 50 | Namespace Windows
|
---|
[545] | 51 | Namespace UI
|
---|
[303] | 52 |
|
---|
[1] | 53 | Class WindowHandle
|
---|
| 54 | hwnd As HWND
|
---|
| 55 | Public
|
---|
| 56 | Sub WindowHandle()
|
---|
| 57 | hwnd = 0
|
---|
| 58 | End Sub
|
---|
| 59 |
|
---|
| 60 | Sub WindowHandle(hwndNew As HWND)
|
---|
| 61 | hwnd = hwndNew
|
---|
| 62 | End Sub
|
---|
| 63 |
|
---|
[77] | 64 | Const Function HWnd() As HWND
|
---|
[1] | 65 | Return hwnd
|
---|
| 66 | End Function
|
---|
[42] | 67 |
|
---|
[77] | 68 | Const Function Operator() As HWND
|
---|
[1] | 69 | Return hwnd
|
---|
| 70 | End Function
|
---|
| 71 |
|
---|
[178] | 72 | Function BringToTop() As Boolean
|
---|
| 73 | Return BringWindowToTop(hwnd) As Boolean
|
---|
[77] | 74 | End Function
|
---|
| 75 |
|
---|
[1] | 76 | Function BeginPaint(ByRef ps As PAINTSTRUCT) As HDC
|
---|
[77] | 77 | Return _System_BeginPaint(hwnd, ps)
|
---|
[1] | 78 | End Function
|
---|
[303] | 79 | /*
|
---|
[208] | 80 | Const Function ChildFromPoint(x As Long, y As Long) As WindowHandle
|
---|
| 81 | Return New WindowHandle(ChildWindowFromPoint(hwnd, x, y))
|
---|
[1] | 82 | End Function
|
---|
| 83 |
|
---|
[208] | 84 | Const Function ChildFromPointEx(x As Long, y As Long, flags As DWord) As WindowHandle
|
---|
| 85 | Return New WindowHandle(ChildWindowFromPointEx(hwnd, x, y, flags))
|
---|
[1] | 86 | End Function
|
---|
[303] | 87 | */
|
---|
[178] | 88 | Const Function ClientToScreen(ByRef pt As POINTAPI) As Boolean
|
---|
| 89 | Return _System_ClientToScreen(hwnd, pt) As Boolean
|
---|
[1] | 90 | End Function
|
---|
| 91 |
|
---|
[282] | 92 | Const Function ClientToScreen(ByRef rc As RECT) As Boolean
|
---|
| 93 | Dim ppt = VarPtr(rc) As *POINTAPI
|
---|
| 94 | Return (_System_ClientToScreen(hwnd, ppt[0]) <> FALSE And _System_ClientToScreen(hwnd, ppt[1]) <> FALSE) As Boolean
|
---|
| 95 | End Function
|
---|
| 96 |
|
---|
[178] | 97 | Function Close() As Boolean
|
---|
| 98 | Return CloseWindow(hwnd) As Boolean
|
---|
[1] | 99 | End Function
|
---|
| 100 |
|
---|
[178] | 101 | Function CreateCaret(hbmp As HBITMAP, width As Long, height As Long) As Boolean
|
---|
[303] | 102 | Return _System_CreateCaret(hwnd, hbmp, width, height) As Boolean
|
---|
[1] | 103 | End Function
|
---|
| 104 |
|
---|
[178] | 105 | Function Destroy() As Boolean
|
---|
| 106 | Return DestroyWindow(hwnd) As Boolean
|
---|
[1] | 107 | End Function
|
---|
| 108 |
|
---|
[178] | 109 | Function DrawMenuBar() As Boolean
|
---|
| 110 | Return _System_DrawMenuBar(hwnd) As Boolean
|
---|
[1] | 111 | End Function
|
---|
[303] | 112 | /*
|
---|
[178] | 113 | Function EnableScrollBar(SBFlags As DWord, arrows As DWord) As Boolean
|
---|
| 114 | Return EnableScrollBar(hwnd, SBFlags, arrows) As Boolean
|
---|
[1] | 115 | End Function
|
---|
[303] | 116 | */
|
---|
[178] | 117 | Function Enable(enable As Boolean) As Boolean
|
---|
| 118 | Return EnableWindow(hwnd, enable) As Boolean
|
---|
[1] | 119 | End Function
|
---|
| 120 |
|
---|
[178] | 121 | Function EndPaint(ByRef ps As PAINTSTRUCT) As Boolean
|
---|
| 122 | Return _System_EndPaint(hwnd, ps) As Boolean
|
---|
[1] | 123 | End Function
|
---|
| 124 |
|
---|
[178] | 125 | Const Function EnumChilds(enumFunc As WNDENUMPROC, lp As LPARAM) As Boolean
|
---|
| 126 | Return EnumChildWindows(hwnd, enumFunc, lp) As Boolean
|
---|
[1] | 127 | End Function
|
---|
| 128 |
|
---|
[178] | 129 | Function Flash(invert As Boolean) As Boolean
|
---|
| 130 | Return FlashWindow(hwnd, invert) As Boolean
|
---|
[1] | 131 | End Function
|
---|
| 132 |
|
---|
[77] | 133 | Const Function GetClassLongPtr(index As Long) As LONG_PTR
|
---|
[272] | 134 | Return _System_GetClassLongPtr(hwnd, index)
|
---|
[1] | 135 | End Function
|
---|
| 136 |
|
---|
[192] | 137 | Const Function GetClassName(className As PTSTR, maxCount As Long) As Long
|
---|
[303] | 138 | Return _System_GetClassName(hwnd, className, maxCount)
|
---|
[1] | 139 | End Function
|
---|
| 140 |
|
---|
[178] | 141 | Const Function GetClientRect(ByRef rc As RECT) As Boolean
|
---|
| 142 | Return _System_GetClientRect(hwnd, rc) As Boolean
|
---|
[1] | 143 | End Function
|
---|
[303] | 144 | /*
|
---|
[77] | 145 | Const Function GetContextHelpId() As DWord
|
---|
| 146 | Return GetWindowContextHelpId(hwnd)
|
---|
| 147 | End Function
|
---|
[303] | 148 | */
|
---|
[1] | 149 | Function GetDC() As HDC
|
---|
[285] | 150 | Return _System_GetDC(hwnd)
|
---|
[1] | 151 | End Function
|
---|
| 152 |
|
---|
| 153 | Function GetDCEx(hrgnClip As HRGN, flags As DWord) As HDC
|
---|
[303] | 154 | Return _System_GetDCEx(hwnd, hrgnClip, flags)
|
---|
[1] | 155 | End Function
|
---|
[303] | 156 | /*
|
---|
[77] | 157 | Const Function GetDlgCtrlID() As Long
|
---|
[1] | 158 | Return GetDlgCtrlID(hwnd)
|
---|
| 159 | End Function
|
---|
| 160 |
|
---|
[77] | 161 | Const Function GetDlgItem(idDlgItem As Long) As WindowHandle
|
---|
[1] | 162 | Return GetDlgItem(hwnd, idDlgItem)
|
---|
| 163 | End Function
|
---|
| 164 |
|
---|
[192] | 165 | Const Function GetDlgItemText(idDlgItem As Long, ps As PTSTR, maxCount As Long) As Long
|
---|
[1] | 166 | Return GetDlgItemText(hwnd, idDlgItem, ps, maxCount)
|
---|
| 167 | End Function
|
---|
[303] | 168 | */
|
---|
[77] | 169 | Const Function GetMenu() As HMENU
|
---|
| 170 | Return _System_GetMenu(hwnd)
|
---|
[1] | 171 | End Function
|
---|
[303] | 172 | /*
|
---|
[77] | 173 | Const Function GetParent() As WindowHandle
|
---|
[285] | 174 | Return New WindowHandle(_System_GetParent(hwnd))
|
---|
[1] | 175 | End Function
|
---|
[303] | 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
|
---|
[303] | 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
|
---|
[303] | 208 | */
|
---|
[1] | 209 | Function GetWindowDC() As HDC
|
---|
[303] | 210 | Return _System_GetWindowDC(hwnd)
|
---|
[1] | 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
|
---|
[303] | 216 | /*
|
---|
[178] | 217 | Const Function GetWindowPlasement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
|
---|
| 218 | Return GetWindowPlasement(hwnd, wndpl) As Boolean
|
---|
[1] | 219 | End Function
|
---|
[303] | 220 | */
|
---|
[178] | 221 | Const Function GetWindowRect(ByRef rc As RECT) As Boolean
|
---|
[303] | 222 | Return _System_GetWindowRect(hwnd, rc) As Boolean
|
---|
[1] | 223 | End Function
|
---|
| 224 |
|
---|
[192] | 225 | Const Function GetText(ps As PTSTR, maxCount As Long) As Boolean
|
---|
[303] | 226 | Return GetWindowText(hwnd, 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
|
---|
[303] | 234 | Return _System_GetWindowThreadProcessId(hwnd, 0)
|
---|
[1] | 235 | End Function
|
---|
| 236 |
|
---|
[303] | 237 | Const Function GetWindowThreadProcessId(ByRef processId As DWord) As DWord
|
---|
| 238 | Return _System_GetWindowThreadProcessId(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
|
---|
[303] | 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
|
---|
[303] | 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
|
---|
[303] | 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
|
---|
[303] | 304 | */
|
---|
[178] | 305 | Function LockUpdate() As Boolean
|
---|
| 306 | Return LockWindowUpdate(hwnd) As Boolean
|
---|
[1] | 307 | End Function
|
---|
[303] | 308 | /*
|
---|
[1] | 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
|
---|
[303] | 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 |
|
---|
[303] | 337 | Function Move(ByRef rc As RECT, repaint 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
|
---|
[303] | 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
|
---|
[303] | 356 | */
|
---|
[178] | 357 | Function PostMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As Boolean
|
---|
[303] | 358 | Return _System_PostMessage(hwnd, msg, wp, lp) As Boolean
|
---|
[1] | 359 | End Function
|
---|
| 360 |
|
---|
[178] | 361 | Function PostMessage(msg As DWord) As Boolean
|
---|
[303] | 362 | Return _System_PostMessage(hwnd, msg, 0, 0) As Boolean
|
---|
[1] | 363 | End Function
|
---|
[303] | 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
|
---|
[303] | 368 | */
|
---|
[178] | 369 | Function ReleaseDC(hdc As HDC) As Boolean
|
---|
[285] | 370 | Return _System_ReleaseDC(hwnd, hdc) As Boolean
|
---|
[1] | 371 | End Function
|
---|
[303] | 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
|
---|
[303] | 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
|
---|
[303] | 399 | Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, wp, lp)
|
---|
[1] | 400 | End Function
|
---|
| 401 |
|
---|
| 402 | Function SendDlgItemMessage(idDlgItem As Long, msg As DWord) As LRESULT
|
---|
[303] | 403 | Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, 0, 0)
|
---|
[1] | 404 | End Function
|
---|
| 405 |
|
---|
| 406 | Function SendMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
|
---|
[303] | 407 | Return _System_SendMessage(hwnd, msg, wp, lp)
|
---|
[1] | 408 | End Function
|
---|
| 409 |
|
---|
| 410 | Function SendMessage(msg As DWord) As LRESULT
|
---|
[303] | 411 | Return _System_SendMessage(hwnd, msg, 0, 0)
|
---|
[1] | 412 | End Function
|
---|
[303] | 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
|
---|
[303] | 425 | */
|
---|
[1] | 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
|
---|
[303] | 429 | /*
|
---|
[208] | 430 | Function SetFocus() As WindowHandle
|
---|
| 431 | Return New WindowHandle(SetFocus(hwnd))
|
---|
[1] | 432 | End Function
|
---|
[303] | 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
|
---|
[303] | 455 | Return This.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
|
---|
[303] | 465 | /*
|
---|
[1] | 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
|
---|
[303] | 471 | Return This.SetTmer(hwnd, idEvent, elapse, 0)
|
---|
[1] | 472 | End Function
|
---|
| 473 |
|
---|
[178] | 474 | Function SetContextHelpId(contextHelpId As DWord) As Boolean
|
---|
| 475 | Return SetContextHelpId(hwnd, contextHelpId) As Boolean
|
---|
[1] | 476 | End Function
|
---|
[303] | 477 | */
|
---|
[1] | 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
|
---|
[303] | 481 | /*
|
---|
[178] | 482 | Function SetWindowPlacement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
|
---|
| 483 | Return SetWindowPlacement(hwnd, wndpl) As Boolean
|
---|
[1] | 484 | End Function
|
---|
[303] | 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
|
---|
[303] | 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
|
---|
[303] | 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
|
---|
[303] | 557 | #ifdef _UNDEF
|
---|
[77] | 558 | Const Function GetWndProc() As WNDPROC
|
---|
[303] | 559 | Return _System_GetWindowLongPtr(hwnd, GWLP_WNDPROC) As WNDPROC
|
---|
[1] | 560 | End Function
|
---|
[303] | 561 | #endif
|
---|
[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
|
---|
[303] | 577 | #ifdef _UNDEF
|
---|
[1] | 578 | Function SetWndProc(wndProc As WNDPROC) As WNDPROC
|
---|
[303] | 579 | Return _System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, wndProc As WNDPROC) As WNDPROC
|
---|
[1] | 580 | End Function
|
---|
[303] | 581 | #endif
|
---|
[1] | 582 | Function SetUserData(value As LONG_PTR) As LONG_PTR
|
---|
[303] | 583 | Return _System_SetWindowLongPtr(hwnd, GWLP_USERDATA, value As LONG_PTR)
|
---|
[1] | 584 | End Function
|
---|
| 585 |
|
---|
| 586 | ' Propaties
|
---|
| 587 |
|
---|
[77] | 588 | Const Function ClientRect() As RECT
|
---|
[473] | 589 | _System_GetClientRect(hwnd, ClientRect)
|
---|
[1] | 590 | End Function
|
---|
[303] | 591 | #ifdef _UNDEF
|
---|
[1] | 592 | Sub ClientRect(ByRef rc As RECT)
|
---|
| 593 | Dim hasMenu As BOOL
|
---|
[303] | 594 | If IsChild() = False And GetMenu() <> 0 Then
|
---|
[1] | 595 | hasMenu = TRUE
|
---|
| 596 | Else
|
---|
| 597 | hasMenu = FALSE
|
---|
[178] | 598 | End If
|
---|
[1] | 599 | AdjustWindowRectEx(rc, GetStyle(), hasMenu, GetExStyle())
|
---|
[303] | 600 | This.Move(rc) ' WindowRect = rc
|
---|
[1] | 601 | End Sub
|
---|
[303] | 602 | #endif
|
---|
[77] | 603 | Const Function WindowRect() As RECT
|
---|
[473] | 604 | _System_GetWindowRect(hwnd, WindowRect)
|
---|
[1] | 605 | End Function
|
---|
| 606 |
|
---|
| 607 | Sub WindowRect(ByRef rc As RECT)
|
---|
[303] | 608 | This.Move(rc)
|
---|
[1] | 609 | End Sub
|
---|
[303] | 610 | #ifdef _UNDEF
|
---|
[77] | 611 | Const Function ContextHelpID() As DWord
|
---|
[1] | 612 | Return GetContextHelpId(hwnd)
|
---|
| 613 | End Function
|
---|
| 614 |
|
---|
| 615 | Sub ContextHelpID(newID As DWord)
|
---|
[77] | 616 | _System_SetContextHelpId(hwnd, newId)
|
---|
[1] | 617 | End Sub
|
---|
| 618 |
|
---|
[77] | 619 | Const Function DlgCtrlID() As Long
|
---|
[1] | 620 | Return GetDlgCtrlID(hwnd)
|
---|
| 621 | End Function
|
---|
| 622 |
|
---|
| 623 | Sub DlgCtrlId(newId As Long)
|
---|
[77] | 624 | _System_SetWindowLongPtr(hwnd, GWLP_ID, newId)
|
---|
[1] | 625 | End Sub
|
---|
| 626 |
|
---|
| 627 | Function DlgItem(idDlgItem As Long) As WindowHandle
|
---|
[77] | 628 | Dim w As WindowHandle(GetDlgItem(hwnd, idDlgItem))
|
---|
| 629 | Return w
|
---|
[1] | 630 | End Function
|
---|
[303] | 631 | #endif
|
---|
[77] | 632 | Const Function ExStyle() As DWord
|
---|
| 633 | Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
|
---|
[1] | 634 | End Function
|
---|
| 635 |
|
---|
| 636 | Sub ExStyle(newExStyle As DWord)
|
---|
[303] | 637 | _System_SetWindowLongPtr(hwnd, GWL_EXSTYLE, newExStyle)
|
---|
[1] | 638 | End Sub
|
---|
| 639 |
|
---|
[77] | 640 | Const Function Style() As DWord
|
---|
| 641 | Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
|
---|
[1] | 642 | End Function
|
---|
| 643 |
|
---|
[223] | 644 | Sub Style(newStyle As DWord)
|
---|
[303] | 645 | _System_SetWindowLongPtr(hwnd, GWL_STYLE, newStyle)
|
---|
[1] | 646 | End Sub
|
---|
| 647 |
|
---|
[178] | 648 | Const Function Enabled() As Boolean
|
---|
| 649 | Return IsWindowEnabled(hwnd) As Boolean
|
---|
[1] | 650 | End Function
|
---|
| 651 |
|
---|
[178] | 652 | Sub Enabled(enable As Boolean)
|
---|
[1] | 653 | EnableWindow(hwnd, enable)
|
---|
| 654 | End Sub
|
---|
| 655 |
|
---|
[77] | 656 | Const Function Font() As HFONT
|
---|
[303] | 657 | Return _System_SendMessage(hwnd, WM_GETFONT, 0, 0) As HFONT
|
---|
[1] | 658 | End Function
|
---|
| 659 |
|
---|
| 660 | Sub Font(hfntNew As HFONT)
|
---|
[303] | 661 | _System_SendMessage(hwnd, WM_SETFONT, hfntNew As WPARAM, TRUE)
|
---|
[1] | 662 | End Sub
|
---|
| 663 |
|
---|
[178] | 664 | Const Function Maximized() As Boolean
|
---|
[272] | 665 | Return IsIconic() As Boolean
|
---|
[1] | 666 | End Function
|
---|
| 667 |
|
---|
[178] | 668 | Sub Maximized(maximized As Boolean)
|
---|
| 669 | If maximized <> False Then
|
---|
[1] | 670 | ShowWindow(hwnd, SW_SHOWMAXIMIZED)
|
---|
| 671 | Else
|
---|
| 672 | ShowWindow(hwnd, SW_RESTORE)
|
---|
| 673 | End If
|
---|
| 674 | End Sub
|
---|
| 675 |
|
---|
[178] | 676 | Const Function Minimized() As Boolean
|
---|
[303] | 677 | Return _System_IsIconic(hwnd) As Boolean
|
---|
[1] | 678 | End Function
|
---|
| 679 |
|
---|
[178] | 680 | Sub Minimized(minimized As Boolean)
|
---|
| 681 | If minimized <> False Then
|
---|
[1] | 682 | CloseWindow(hwnd)
|
---|
| 683 | Else
|
---|
| 684 | OpenIcon(hwnd)
|
---|
| 685 | End If
|
---|
| 686 | End Sub
|
---|
| 687 |
|
---|
[77] | 688 | Const Function Instance() As HINSTANCE
|
---|
| 689 | Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
|
---|
[1] | 690 | End Function
|
---|
| 691 |
|
---|
| 692 | ' IsWindow, IsUnicodeはメソッドと同じ。
|
---|
| 693 |
|
---|
[77] | 694 | Const Function Parent() As WindowHandle
|
---|
[223] | 695 | Return New WindowHandle(_System_GetParent(hwnd))
|
---|
[1] | 696 | End Function
|
---|
| 697 |
|
---|
| 698 | Sub Parent(hwndNewParent As HWND)
|
---|
[77] | 699 | _System_SetParent(hwnd, hwndNewParent)
|
---|
[1] | 700 | End Sub
|
---|
| 701 |
|
---|
[303] | 702 | Const Function ProcessId() As DWord
|
---|
| 703 | GetWindowThreadProcessId(ProcessId)
|
---|
[1] | 704 | End Function
|
---|
| 705 |
|
---|
[303] | 706 | Const Function ThreadId() As DWord
|
---|
| 707 | Return GetWindowThreadProcessId(ByVal 0)
|
---|
[1] | 708 | End Function
|
---|
| 709 |
|
---|
[77] | 710 | Const Function Menu() As HMENU
|
---|
| 711 | Return _System_GetMenu(hwnd)
|
---|
[1] | 712 | End Function
|
---|
| 713 |
|
---|
| 714 | Sub Menu(hmenuNew As HMENU)
|
---|
[77] | 715 | _System_SetMenu(hwnd, hmenuNew)
|
---|
[1] | 716 | End Sub
|
---|
| 717 |
|
---|
[192] | 718 | Const Function Prop(str As String) As HANDLE
|
---|
| 719 | Return GetProp(str)
|
---|
| 720 | End Function
|
---|
| 721 |
|
---|
| 722 | Const Function Prop(psz As PCTSTR) As HANDLE
|
---|
| 723 | Return GetProp(psz)
|
---|
| 724 | End Function
|
---|
| 725 |
|
---|
| 726 | Const Function Prop(atom As ATOM) As HANDLE
|
---|
| 727 | Return GetProp(atom)
|
---|
| 728 | End Function
|
---|
| 729 |
|
---|
| 730 | Sub Prop(str As PCTSTR, h As HANDLE)
|
---|
| 731 | SetProp(str, h)
|
---|
| 732 | End Sub
|
---|
| 733 |
|
---|
| 734 | Sub Prop(atom As ATOM, h As HANDLE)
|
---|
| 735 | SetProp(atom, h)
|
---|
| 736 | End Sub
|
---|
| 737 |
|
---|
[77] | 738 | Const Function Text() As String
|
---|
[192] | 739 | Dim size = GetWindowTextLength(hwnd) + 1
|
---|
[272] | 740 | Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PTSTR
|
---|
[192] | 741 | Dim length = GetWindowText(hwnd, p, size)
|
---|
[272] | 742 | Text = New String(p, length As Long)
|
---|
[1] | 743 | End Function
|
---|
| 744 |
|
---|
[192] | 745 | Sub Text(newText As String)
|
---|
| 746 | SetWindowText(hwnd, ToTCStr(newText))
|
---|
| 747 | End Sub
|
---|
| 748 |
|
---|
| 749 | Sub Text(newText As PCTSTR)
|
---|
[1] | 750 | SetWindowText(hwnd, newText)
|
---|
| 751 | End Sub
|
---|
| 752 |
|
---|
[77] | 753 | Const Function TextLength() As Long
|
---|
[1] | 754 | Return GetWindowTextLength(hwnd)
|
---|
| 755 | End Function
|
---|
[303] | 756 | #ifdef _UNDEF
|
---|
[77] | 757 | Const Function UserData() As LONG_PTR
|
---|
| 758 | Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)
|
---|
[1] | 759 | End Function
|
---|
| 760 |
|
---|
| 761 | Sub UserData(newValue As LONG_PTR)
|
---|
[77] | 762 | _System_SetWindowLongPtr(hwnd, GWLP_USERDATA, newValue)
|
---|
[1] | 763 | End Sub
|
---|
[303] | 764 | #endif
|
---|
[178] | 765 | Const Function Visible() As Boolean
|
---|
[303] | 766 | Return IsWindowVisible(hwnd) As Boolean
|
---|
[1] | 767 | End Function
|
---|
| 768 |
|
---|
[178] | 769 | Sub Visible(visible As Boolean)
|
---|
| 770 | If visible <> False Then
|
---|
[1] | 771 | ShowWindow(hwnd, SW_SHOW)
|
---|
| 772 | Else
|
---|
| 773 | ShowWindow(hwnd, SW_HIDE)
|
---|
| 774 | EndIf
|
---|
| 775 | End Sub
|
---|
[303] | 776 | #ifdef _UNDEF
|
---|
[77] | 777 | Const Function WindowPlacement() As WINDOWPLACEMENT
|
---|
[1] | 778 | WindowPlacement.length = Len(WindowPlacement)
|
---|
| 779 | GetWindowPlacement(hwnd, WindowPlacement)
|
---|
| 780 | End Function
|
---|
| 781 |
|
---|
| 782 | Sub WindowPlacement(ByRef wndpl As WINDOWPLACEMENT)
|
---|
| 783 | SetWindowPlacement(wndpl)
|
---|
| 784 | End Sub
|
---|
| 785 |
|
---|
[77] | 786 | Const Function WndProc() As WNDPROC
|
---|
| 787 | Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As WNDPROC
|
---|
[1] | 788 | End Function
|
---|
| 789 |
|
---|
| 790 | Sub WndProc(newWndProc As WNDPROC)
|
---|
[77] | 791 | _System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, newWndProc As LONG_PTR)
|
---|
[1] | 792 | End Sub
|
---|
[303] | 793 | #endif
|
---|
[1] | 794 | Protected
|
---|
| 795 | Sub SetHWnd(hwndNew As HWND)
|
---|
| 796 | hwnd = hwndNew
|
---|
| 797 | End Sub
|
---|
| 798 | End Class
|
---|
| 799 |
|
---|
[545] | 800 | End Namespace 'UI
|
---|
[303] | 801 | End Namespace 'Widnows
|
---|
| 802 | End Namespace 'ActiveBasic
|
---|