source: Include/windows/WindowHandle.sbp@ 192

Last change on this file since 192 was 192, checked in by イグトランス (egtra), 17 years ago

Currencyを追加、その他修正

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