Ignore:
Timestamp:
Jan 27, 2007, 12:04:09 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/windows/WindowHandle.sbp

    r42 r77  
    11#ifndef __WINDOWSHANDLE_SBP__
    22#define __WINDOWSHANDLE_SBP__
     3
     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
    331
    432Class WindowHandle
     
    2149    End Sub
    2250
    23     Function HWnd() As HWND
     51    Const Function HWnd() As HWND
    2452        Return hwnd
    2553    End Function
    2654
    27     Function Operator() As HWND
     55    Const Function Operator() As HWND
    2856        Return hwnd
    2957    End Function
    3058
     59    Function BringToTop() As BOOL
     60        Return BringWindowToTop(hwnd)
     61    End Function
     62
    3163    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
     64        Return _System_BeginPaint(hwnd, ps)
     65    End Function
     66
     67    Const Function ChildFromPoint(x As Long, y As Long) As HWND
    3668        Return ChildWindowFromPoint(hwnd, x, y)
    3769    End Function
    3870
    39     Function ChildFromPointEx(x As Long, y As Long, flags As DWord) As HWND
     71    Const Function ChildFromPointEx(x As Long, y As Long, flags As DWord) As HWND
    4072        Return ChildWindowFromPointEx(hwnd, x, y, flags)
    4173    End Function
    4274
    43     Function ClientToScreen(ByRef pt As POINTAPI) As BOOL
    44         Return ClientToScreen(pt)
     75    Const Function ClientToScreen(ByRef pt As POINTAPI) As BOOL
     76        Return _System_ClientToScreen(hwnd, pt)
    4577    End Function
    4678
    4779    Function Close() As BOOL
    48         Return CloseWindow()
     80        Return CloseWindow(hwnd)
    4981    End Function
    5082
    5183    Function CreateCaret(hbmp As HBITMAP, width As Long, height As Long) As BOOL
    52         Return CreateCaret(hwnd, hbmp, width, hegiht)
     84        Return _System_CreateCaret(hwnd, hbmp, width, hegiht)
    5385    End Function
    5486
     
    5890
    5991    Function DrawMenuBar() As BOOL
    60         Return DrawMenuBar(hwnd)
     92        Return _System_DrawMenuBar(hwnd)
    6193    End Function
    6294
     
    70102
    71103    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
     104        Return _System_EndPaint(hwnd, ps)
     105    End Function
     106
     107    Const Function EnumChilds(enumFunc As WNDENUMPROC, lp As LPARAM) As BOOL
    76108        Return EnumChildWindows(hwnd, enumFunc, lp)
    77109    End Function
     
    81113    End Function
    82114
    83     Function GetClassLongPtr(index As Long) As LONG_PTR
     115    Const Function GetClassLongPtr(index As Long) As LONG_PTR
    84116        Return GetClassLongPtr(hwnd, index)
    85117    End Function
    86118
    87     Function GetClassName(className As PSTR, maxCount As Long) As Long
     119    Const Function GetClassName(className As PSTR, maxCount As Long) As Long
    88120        Return GetClassName(className, maxCount)
    89121    End Function
    90122
    91     Function GetClientRect(ByRef rc As RECT) As BOOL
    92         Return GetClientRect(hwnd, rc)
     123    Const Function GetClientRect(ByRef rc As RECT) As BOOL
     124        Return _System_GetClientRect(hwnd, rc)
     125    End Function
     126
     127    Const Function GetContextHelpId() As DWord
     128        Return GetWindowContextHelpId(hwnd)
    93129    End Function
    94130
     
    101137    End Function
    102138
    103     Function GetDlgCtrlID() As Long
     139    Const Function GetDlgCtrlID() As Long
    104140        Return GetDlgCtrlID(hwnd)
    105141    End Function
    106142
    107     Function GetDlgItem(idDlgItem As Long) As WindowHandle
     143    Const Function GetDlgItem(idDlgItem As Long) As WindowHandle
    108144        Return GetDlgItem(hwnd, idDlgItem)
    109145    End Function
    110146
    111     Function GetDlgItemText(idDlgItem As Long, ps As PSTR, maxCount As Long) As Long
     147    Const Function GetDlgItemText(idDlgItem As Long, ps As PSTR, maxCount As Long) As Long
    112148        Return GetDlgItemText(hwnd, idDlgItem, ps, maxCount)
    113149    End Function
    114150
    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
     151    Const Function GetMenu() As HMENU
     152        Return _System_GetMenu(hwnd)
     153    End Function
     154
     155    Const Function GetParent() As WindowHandle
     156        Dim w As WindowHandle(_System_GetParent(hwnd))
     157        Return w
     158    End Function
     159
     160    Const Function GetProp(psz As PCSTR) As HANDLE
    124161        Return GetProp(hwnd, psz)
    125162    End Function
    126163
    127     Function GetProp(atom As ATOM) As HANDLE
     164    Const Function GetProp(atom As ATOM) As HANDLE
    128165        Return GetProp(hwnd, atom As ULONG_PTR As PCSTR)
    129166    End Function
    130167
    131     Function GetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO) As BOOL
     168    Const Function GetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO) As BOOL
    132169        Return GetScrollInfo(hwnd, fnBar, si)
    133170    End Function
    134171
    135     Function GetSystemMenu(revert As BOOL) As HMENU
     172    Const Function GetSystemMenu(revert As BOOL) As HMENU
    136173        Return GetSystemMenu(hwnd, revert)
    137174    End Function
    138175
    139     Function GetUpdateRect(ByRef rc As RECT, erase As BOOL) As BOOL
     176    Const Function GetUpdateRect(ByRef rc As RECT, erase As BOOL) As BOOL
    140177        Return GetUpdateRact(hwnd, rc, erase)
    141178    End Function
    142179
    143     Function GetUpdateRgn(hrgn As HRGN, erase As BOOL) As BOOL
     180    Const Function GetUpdateRgn(hrgn As HRGN, erase As BOOL) As BOOL
    144181        Return GetUpdateRgn(hwnd, hrgn, erase)
    145182    End Function
    146183
    147     Function GetWindow(cmd As DWord) As WindowHandle
     184    Const Function GetWindow(cmd As DWord) As WindowHandle
    148185        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)
    157186    End Function
    158187
     
    161190    End Function
    162191
    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
     192    Const Function GetWindowLongPtr(index As Long) As LONG_PTR
     193        Return _System_GetWindowLongPtr(hwnd, index)
     194    End Function
     195
     196    Const Function GetWindowPlasement(ByRef wndpl As WINDOWPLACEMENT) As BOOL
    168197        Return GetWindowPlasement(hwnd, wndpl)
    169198    End Function
    170199
    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
     200    Const Function GetWindowRect(ByRef rc As RECT) As BOOL
     201        Return _System_GetWindowRect(rc)
     202    End Function
     203
     204    Const Function GetText(ps As PSTR, maxCount As Long) As BOOL
    176205        Return GetWindowText(ps, maxCount)
    177206    End Function
    178207
    179     Function GetTextLength() As Long
     208    Const Function GetTextLength() As Long
    180209        Return GetWindowTextLength(hwnd)
    181210    End Function
    182211
    183     Function GetWindowThreadId() As DWord
     212    Const Function GetWindowThreadId() As DWord
    184213        Return GetWindowProcessThreadId(hwnd, 0)
    185214    End Function
    186215
    187     Function GetWindowProcessThreadId(ByRef processId As DWord) As DWord
     216    Const Function GetWindowProcessThreadId(ByRef processId As DWord) As DWord
    188217        Return GetWindowProcessThreadId(hwnd, processId)
    189218    End Function
    190219
    191220    Function HideCaret() As BOOL
    192         Return HideCaret(hwnd)
     221        Return _System_HideCaret(hwnd)
    193222    End Function
    194223
    195224    Function InvalidateRect(ByRef rc As RECT, erace As BOOL) As BOOL
    196         Return InvalidateRect(hwnd, rc, erace)
     225        Return _System_InvalidateRect(hwnd, rc, erace)
    197226    End Function
    198227
    199228    Function InvalidateRect(ByRef rc As RECT) As BOOL
    200         Return InvalidateRect(hwnd, rc, TRUE)
     229        Return _System_InvalidateRect(hwnd, rc, TRUE)
    201230    End Function
    202231
    203232    Function InvalidateRgn(hrgn As HRGN, erace As BOOL) As BOOL
    204         Return InvalidateRgn(hwnd, hrgn, erace)
     233        Return _System_InvalidateRgn(hwnd, hrgn, erace)
    205234    End Function
    206235
    207236    Function InvalidateRgn(hrgn As HRGN) As BOOL
    208         Return InvalidateRgn(hwnd, hrgn, TRUE)
     237        Return _System_InvalidateRgn(hwnd, hrgn, TRUE)
    209238    End Function
    210239
    211240    Function Invalidate(erace As BOOL) As BOOL
    212         Return InvalidateRect(hwnd, ByVal 0, erace)
     241        Return _System_InvalidateRect(hwnd, ByVal 0, erace)
    213242    End Function
    214243
    215244    Function Invalidate() As BOOL
    216         Return InvalidateRect(hwnd, ByVal 0, TRUE)
    217     End Function
    218 
    219     Function IsChild(hwnd As HWND) As BOOL
     245        Return _System_InvalidateRect(hwnd, ByVal 0, TRUE)
     246    End Function
     247
     248    Const Function IsChild(hwnd As HWND) As BOOL
    220249        Return IsChild(This.hwnd, hwnd)
    221250    End Function
    222251
    223     Function IsDialogMessage(ByRef msg As MSG) As BOOL
     252    Const Function IsDialogMessage(ByRef msg As MSG) As BOOL
    224253        Return IsDialogMessage(hwnd, msg)
    225254    End Function
    226255
    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
     256    Const Function IsIconic() As BOOL
     257        Return _System_IsIconic(hwnd)
     258    End Function
     259
     260    Const Function IsWindow() As BOOL
     261        Return _System_IsWindow(hwnd)
     262    End Function
     263
     264    Const Function IsEnabled() As BOOL
    236265        Return IsWindowEnabled(hwnd)
    237266    End Function
    238267
    239     Function IsUnicode() As BOOL
     268    Const Function IsUnicode() As BOOL
    240269        Return IsWindowUnicode(hwnd)
    241270    End Function
    242271
    243     Function IsVisible() As BOOL
     272    Const Function IsVisible() As BOOL
    244273        Return IsWindowVisible(hwnd)
    245274    End Function
    246275
    247     Function IsZoomed() As BOOL
     276    Const Function IsZoomed() As BOOL
    248277        Return IsZoomed(hwnd)
    249278    End Function
     
    265294    End Function
    266295
    267     Function MessageBox(text As PCSTR, caption As PCSTR, uType As DWord) As Long
     296    Const Function MessageBox(text As PCSTR, caption As PCSTR, uType As DWord) As Long
    268297        Return MessageBox(hwnd, text, caption, uType)
    269298    End Function
    270299
    271     Function MessageBox(text As PCSTR, caption As PCSTR) As Long
     300    Const Function MessageBox(text As PCSTR, caption As PCSTR) As Long
    272301        Return MessageBox(hwnd, text, caption, MB_OK)
    273302    End Function
    274303
    275     Function MessageBox(text As PCSTR) As Long
     304    Const Function MessageBox(text As PCSTR) As Long
    276305        Return MessageBox(hwnd, text, 0, MB_OK)
    277306    End Function
    278307
    279     Function MoveWindow(x As Long, y As Long, width As Long, height As Long, repaint As BOOL) As BOOL
     308    Function Move(x As Long, y As Long, width As Long, height As Long, repaint As BOOL) As BOOL
    280309        Return MoveWindow(hwnd, x, y, width, height, repaint)
    281310    End Function
    282311
    283     Function MoveWindow(x As Long, y As Long, width As Long, height As Long) As BOOL
     312    Function Move(x As Long, y As Long, width As Long, height As Long) As BOOL
    284313        Return MoveWindow(hwnd, x, y, width, height, TRUE)
    285314    End Function
    286315
    287     Function MoveWindow(ByRef rc As RECT, repeaint As BOOL) As BOOL
     316    Function Move(ByRef rc As RECT, repeaint As BOOL) As BOOL
    288317        With rc
    289318            Return MoveWindow(hwnd, .left, .top, .right - .left, .bottom - .top, repaint)
     
    291320    End Function
    292321
    293     Function MoveWindow(ByRef rc As RECT) As BOOL
     322    Function Move(ByRef rc As RECT) As BOOL
    294323        With rc
    295324            Return MoveWindow(hwnd, .left, .top, .right - .left, .bottom - .top, TRUE)
     
    329358    End Function
    330359
    331     Function ScreenToClient(ByRef pt As POINTAPI) As BOOL
    332         Return ScreenToClient(hwnd, pt)
     360    Const Function ScreenToClient(ByRef pt As POINTAPI) As BOOL
     361        Return _System_ScreenToClient(hwnd, pt)
    333362    End Function
    334363
     
    378407
    379408    Function SetMenu(hmenu As HMENU) As BOOL
    380         Return SetMenu(hwnd, hmenu)
     409        Return _System_SetMenu(hwnd, hmenu)
    381410    End Function
    382411
    383412    Function SetParent(hwndNewParent As HWND) As HWND
    384         Return SetParent(hwnd, hwndNewParent)
     413        Return _System_SetParent(hwnd, hwndNewParent)
    385414    End Function
    386415
     
    414443
    415444    Function SetWindowLongPtr(index As Long, newLong As LONG_PTR) As LONG_PTR
    416         Return SetWindowLongPtr(hwnd, index, newLong)
     445        Return _System_SetWindowLongPtr(hwnd, index, newLong)
    417446    End Function
    418447
     
    443472    End Function
    444473
     474    Function ShowCaret() As BOOL
     475        Return _System_ShowCaret(hwnd)
     476    End Function
     477
    445478    Function ShowScrollBar(bar As DWord, show As BOOL) As BOOL
    446479        Return ShowScrollBar(hwnd, bar, show)
     
    464497
    465498    Function ValidateRect(ByRef rc As RECT) As BOOL
    466         Return ValidateRect(hwnd, rc)
     499        Return _System_ValidateRect(hwnd, rc)
    467500    End Function
    468501
    469502    Function ValidateRgn(hrgn As HRGN) As BOOL
    470         Return ValidateRgn(hwnd, hrgn)
     503        Return _System_ValidateRgn(hwnd, hrgn)
    471504    End Function
    472505
    473506    Function Validate() As BOOL
    474         Return ValidateRect(hwnd, ByVal 0)
     507        Return _System_ValidateRect(hwnd, ByVal 0)
    475508    End Function
    476509
    477510    ' Get/SetWindowLongPtr Wrappers
    478511
    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)
     512    Const Function GetExStyle() As DWord
     513        Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
     514    End Function
     515
     516    Const Function GetStyle() As DWord
     517        Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
     518    End Function
     519
     520    Const Function GetWndProc() As WNDPROC
     521        Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As WNDPROC
     522    End Function
     523
     524    Const Function GetInstance() As HINSTANCE
     525        Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
     526    End Function
     527
     528    Const Function GetUserData() As LONG_PTR
     529        Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)
    497530    End Function
    498531
    499532    Function SetExStyle(style As DWord) As DWord
    500         Return SetWindowLongPtr(hwnd, GWL_EXSTYLE, style) As DWord
     533        Return _System_SetWindowLongPtr(hwnd, GWL_EXSTYLE, style) As DWord
    501534    End Function
    502535
    503536    Function SetStyle(style As DWord) As DWord
    504         Return SetWindowLongPtr(hwnd, GWL_STYLE, style) As DWord
     537        Return _System_SetWindowLongPtr(hwnd, GWL_STYLE, style) As DWord
    505538    End Function
    506539
    507540    Function SetWndProc(wndProc As WNDPROC) As WNDPROC
    508         Return SetWindowLongPtR(hwnd, GWLP_WNDPROC, wndProc As WNDPROC) As WNDPROC
     541        Return _System_SetWindowLongPtR(hwnd, GWLP_WNDPROC, wndProc As WNDPROC) As WNDPROC
    509542    End Function
    510543
    511544    Function SetUserData(value As LONG_PTR) As LONG_PTR
    512         Return SetWindowLongPtr(value As LONG_PTR)
     545        Return _System_SetWindowLongPtr(value As LONG_PTR)
    513546    End Function
    514547
    515548    ' Propaties
    516549
    517     Function ClientRect() As RECT
     550    Const Function ClientRect() As RECT
    518551        Dim rc As RECT
    519         GetClientRect(hwnd, rc)
     552        _System_GetClientRect(hwnd, rc)
    520553        Return rc
    521554    End Function
     
    532565    End Sub
    533566
    534     Function WindowRect() As RECT
     567    Const Function WindowRect() As RECT
    535568        Dim rc As RECT
    536         GetWindowRect(hwnd, rc)
     569        _System_GetWindowRect(hwnd, rc)
    537570        Return rc
    538571    End Function
     
    542575    End Sub
    543576
    544     Function ContextHelpID() As DWord
     577    Const Function ContextHelpID() As DWord
    545578        Return GetContextHelpId(hwnd)
    546579    End Function
    547580
    548581    Sub ContextHelpID(newID As DWord)
    549         SetContextHelpId(hwnd, newId)
    550     End Sub
    551 
    552     Function DlgCtrlID() As Long
     582        _System_SetContextHelpId(hwnd, newId)
     583    End Sub
     584
     585    Const Function DlgCtrlID() As Long
    553586        Return GetDlgCtrlID(hwnd)
    554587    End Function
    555588
    556589    Sub DlgCtrlId(newId As Long)
    557         SetWindowLongPtr(hwnd, GWLP_ID, newId)
     590        _System_SetWindowLongPtr(hwnd, GWLP_ID, newId)
    558591    End Sub
    559592
    560593    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
     594        Dim w As WindowHandle(GetDlgItem(hwnd, idDlgItem))
     595        Return w
     596    End Function
     597
     598    Const Function ExStyle() As DWord
     599        Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
    566600    End Function
    567601
    568602    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
     603        _System_SetWindowLongPtr(hwnd, GWLP_EXSTYLE, newExStyle)
     604    End Sub
     605
     606    Const Function Style() As DWord
     607        Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
    574608    End Function
    575609
    576610    Sub Style(newStyle As DWord) DWord
    577         SetWindowLongPtr(hwnd, GWL_STYLE, newStyle)
    578     End Sub
    579 
    580     Function Enabled() As BOOL
     611        _System_SetWindowLongPtr(hwnd, GWLP_STYLE, newStyle)
     612    End Sub
     613
     614    Const Function Enabled() As BOOL
    581615        Return IsWindowEnabled(hwnd)
    582616    End Function
     
    586620    End Sub
    587621
    588     Function Font() As HFONT
     622    Const Function Font() As HFONT
    589623        Return SendMessage(hwnd, WM_GETFONT, 0, 0) As HFONT
    590624    End Function
     
    594628    End Sub
    595629
    596     Function Maximized() As BOOL
     630    Const Function Maximized() As BOOL
    597631        Return IsIconic(hwnd)
    598632    End Function
     
    606640    End Sub
    607641
    608     Function Minimized() As BOOL
     642    Const Function Minimized() As BOOL
    609643        Return IsIconic(hwnd)
    610644    End Function
     
    618652    End Sub
    619653
    620     Function Instance() As HINSTANCE
    621         Return GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
     654    Const Function Instance() As HINSTANCE
     655        Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
    622656    End Function
    623657
    624658    ' IsWindow, IsUnicodeはメソッドと同じ。
    625659
    626     Function Parent() As WindowHandle
    627         Return GetParent(hwnd)
     660    Const Function Parent() As WindowHandle
     661        Return _System_GetParent(hwnd)
    628662    End Function
    629663
    630664    Sub Parent(hwndNewParent As HWND)
    631         SetParent(hwnd, hwndNewParent)
    632     End Sub
    633 
    634     Function ProcessID() As DWord
     665        _System_SetParent(hwnd, hwndNewParent)
     666    End Sub
     667
     668    Const Function ProcessID() As DWord
    635669        GetWindowProcessThreadId(ProcessID)
    636670    End Function
    637671
    638     Function ThreadID() As DWord
     672    Const Function ThreadID() As DWord
    639673        Return GetWindowProcessThreadId(ByVal 0)
    640674    End Function
    641675
    642     Function Menu() As HMENU
    643         Return GetMenu(hwnd)
     676    Const Function Menu() As HMENU
     677        Return _System_GetMenu(hwnd)
    644678    End Function
    645679
    646680    Sub Menu(hmenuNew As HMENU)
    647         SetMenu(hwnd, hmenuNew)
    648     End Sub
    649 
    650     Function Text() As String
     681        _System_SetMenu(hwnd, hmenuNew)
     682    End Sub
     683
     684    Const Function Text() As String
    651685        With Text
    652686            .ReSize(GetWindowTextLength(hwnd))
     
    659693    End Sub
    660694
    661     Function TextLength() As Long
     695    Const Function TextLength() As Long
    662696        Return GetWindowTextLength(hwnd)
    663697    End Function
    664698
    665     Function UserData() As LONG_PTR
    666         Return GetWindowLongPtr(hwnd, GWLP_USERDATA)
     699    Const Function UserData() As LONG_PTR
     700        Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)
    667701    End Function
    668702
    669703    Sub UserData(newValue As LONG_PTR)
    670         SetWindowLongPtr(hwnd, GWLP_USERDATA, newValue)
    671     End Sub
    672 
    673     Function Visible() As BOOL
     704        _System_SetWindowLongPtr(hwnd, GWLP_USERDATA, newValue)
     705    End Sub
     706
     707    Const Function Visible() As BOOL
    674708        Return IsVisible(hwnd)
    675709    End Function
     
    683717    End Sub
    684718
    685     Function WindowPlacement() As WINDOWPLACEMENT
     719    Const Function WindowPlacement() As WINDOWPLACEMENT
    686720        WindowPlacement.length = Len(WindowPlacement)
    687721        GetWindowPlacement(hwnd, WindowPlacement)
     
    692726    End Sub
    693727
    694     Function WndProc() As WNDPROC
    695         Return GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As WNDPROC
     728    Const Function WndProc() As WNDPROC
     729        Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As WNDPROC
    696730    End Function
    697731
    698732    Sub WndProc(newWndProc As WNDPROC)
    699         SetWindowLongPtr(hwnd, GWLP_WNDPROC, newWndProc As LONG_PTR)
     733        _System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, newWndProc As LONG_PTR)
    700734    End Sub
    701735
Note: See TracChangeset for help on using the changeset viewer.