source: Include/windows/WindowHandle.sbp@ 176

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

Controlの追加とそれに伴う修正

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