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