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