Changeset 646 for trunk/ab5.0


Ignore:
Timestamp:
Oct 18, 2008, 5:55:42 PM (16 years ago)
Author:
イグトランス (egtra)
Message:

WindowHandleをWindows.UIの一部として使うために改造。メンバ関数の厳選、例外処理の導入など。

Location:
trunk/ab5.0/ablib/src/Classes
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Control.ab

    r637 r646  
    3737    @brief HWNDからControlインスタンスを取得する。
    3838    @param[in] hwnd 対象のウィンドウハンドル
    39     @return 対応するControlインスタンス。ただし、存在しなければNothing。
     39    @return 対応するControlインスタンス。存在しなければ作成される。ただし、hwndがNULLならNothing。
    4040    */
    4141    Static Function FromHWnd(hwnd As HWND) As Control
    4242        FromHWnd = Nothing
    43         If _System_IsWindow(hwnd) Then
     43        If IsWindow(hwnd) Then
    4444            FromHWnd = FromHWndCore(hwnd)
     45            If ActiveBasic.IsNothing(FromHWnd) Then
     46                Dim lock = New ActiveBasic.Windows.CriticalSectionLock(_System_CriticalSection)
     47                Try
     48                    FromHWnd = New Control
     49                    FromHWnd.registerStandardEvent()
     50                    FromHWnd.AssociateHWnd(hwnd)
     51                Finally
     52                    lock.Dispose()
     53                End Try
     54            End If
    4555        End If
    4656    End Function
     
    104114
    105115Protected
    106     Abstract Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
     116    Virtual Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
     117    End Sub
    107118
    108119    Sub createImpl(ByRef cs As CREATESTRUCT, parent As Control)
     
    131142
    132143Public
     144/*
    133145    Sub Attach(hwndNew As HWND)
    134146        throwIfAlreadyCreated()
     
    139151        AssociateHWnd(hwndNew)
    140152    End Sub
    141 
     153*/
    142154    Sub BeginSubclass()
    143155        throwIfNotCreated()
    144         prevWndProc = SetWindowLongPtr(GWLP_WNDPROC, AddressOf(WndProcFirst) As LONG_PTR) As WNDPROC
     156        prevWndProc = SetWindowLongPtr(hwnd, GWLP_WNDPROC, AddressOf(WndProcFirst) As LONG_PTR) As WNDPROC
    145157    End Sub
    146158
     
    305317        Else
    306318            Dim ps As PAINTSTRUCT
    307             BeginPaint(ps)
     319            BeginPaint(hwnd, ps)
    308320            Try
    309321                OnPaintDC(New PaintDCArgs(ps.hdc, ps.rcPaint))
    310322            Finally
    311                 EndPaint(ps)
     323                EndPaint(hwnd, ps)
    312324            End Try
    313325        End If
  • trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Dialog.ab

    r637 r646  
    4040                    DefDlgProc = lr
    4141                Case Else
    42                     _System_SetWindowLongPtr(hDlg, DWLP_MSGRESULT, lr)
     42                    SetWindowLongPtr(hDlg, DWLP_MSGRESULT, lr)
    4343            End Select
    4444        End If
  • trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/WindowHandle.ab

    r639 r646  
    11'Classes/ActiveBasic/Windows/UI/WindowHandle.sbp
    22
    3 #ifdef _WIN64
    4 Declare Function _System_GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
    5 Declare Function _System_SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLongPtr (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
    6 Declare Function _System_GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
    7 Declare Function _System_SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLongPtr (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
    8 #else
    9 Declare Function _System_GetClassLongPtr Lib "user32" Alias _FuncName_GetClassLong (hWnd As HWND, nIndex As Long) As LONG_PTR
    10 Declare Function _System_SetClassLongPtr Lib "user32" Alias _FuncName_SetClassLong (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
    11 Declare Function _System_GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLong (hWnd As HWND, nIndex As Long) As LONG_PTR
    12 Declare Function _System_SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLong (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
    13 #endif
    14 Declare Function _System_GetParent Lib "user32" Alias "GetParent" (hWnd As HWND) As HWND
    15 Declare Function _System_SetParent Lib "user32" Alias "SetParent" (hWnd As HWND, hwndParent As HWND) As HWND
    163Declare Function _System_GetMenu Lib "user32" Alias "GetMenu" (hWnd As HWND) As HMENU
    17 Declare Function _System_SetMenu Lib "user32" Alias "SetMenu" (hWnd As HWND, hmenu As HMENU) As HMENU
    18 Declare Function _System_InvalidateRect Lib "user32" Alias "InvalidateRect" (hWnd As HWND, ByRef Rect As RECT, bErase As BOOL) As BOOL
    19 Declare Function _System_InvalidateRgn Lib "user32" Alias "InvalidateRgn" (hWnd As HWND, hRgn As HRGN, bErase As BOOL) As BOOL
     4Declare Function _System_SetMenu Lib "user32" Alias "SetMenu" (hWnd As HWND, hmenu As HMENU) As BOOL
    205Declare Function _System_ValidateRect Lib "user32" Alias "ValidateRect" (hWnd As HWND, ByRef Rect As RECT) As BOOL
    216Declare Function _System_ValidateRgn Lib "user32" Alias "ValidateRgn" (hWnd As HWND, hRgn As HRGN) As BOOL
    22 Declare Function _System_BeginPaint Lib "user32" Alias "BeginPaint" (hWnd As HWND, ByRef ps As PAINTSTRUCT) As HDC
    23 Declare Function _System_EndPaint Lib "user32" Alias "EndPaint" (hWnd As HWND, ByRef ps As PAINTSTRUCT) As HDC
    247Declare Function _System_ClientToScreen Lib "user32" Alias "ClientToScreen" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
    258Declare Function _System_ScreenToClient Lib "user32" Alias "ScreenToClient" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
     
    2811Declare Function _System_ShowCaret Lib "user32" Alias "ShowCaret" (hWnd As HWND) As BOOL
    2912Declare Function _System_DrawMenuBar Lib "user32" Alias "DrawMenuBar" (hwnd As HWND) As BOOL
    30 Declare Function _System_GetWindowRect Lib "user32" Alias "DrawMenuBar" (hWnd As HWND, ByRef Rect As RECT) As BOOL
    31 Declare Function _System_IsWindow Lib "user32" Alias "IsWindow" (hWnd As HWND) As BOOL
    32 Declare Function _System_IsIconic Lib "user32" Alias "IsIconic" (hWnd As HWND) As BOOL
    33 Declare Function _System_GetClassName Lib "user32" Alias _FuncName_GetClassName (hWnd As HWND, lpClassName As PTSTR, nMaxCount As Long) As Long
    3413Declare Function _System_GetScrollInfo Lib "user32" Alias "GetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO) As BOOL
    3514Declare Function _System_SetScrollInfo Lib "user32" Alias "SetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO, bRedraw As Long) As BOOL
     
    3918Declare Function _System_GetWindowDC Lib "user32" Alias "GetWindowDC" (hwnd As HWND) As HDC
    4019Declare Function _System_ReleaseDC Lib "user32" Alias "ReleaseDC" (hwnd As HWND, hdc As HDC) As BOOL
    41 Declare Function _System_SendMessage Lib "user32" Alias _FuncName_SendMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
    42 Declare Function _System_PostMessage Lib "user32" Alias _FuncName_PostMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
    43 Declare Function _System_SendDlgItemMessage Lib "user32" Alias _FuncName_SendDlgItemMessage (hwnd As HWND, id As DWord, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
     20'Declare Function _System_SendMessage Lib "user32" Alias _FuncName_SendMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
     21'Declare Function _System_PostMessage Lib "user32" Alias _FuncName_PostMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
     22'Declare Function _System_SendDlgItemMessage Lib "user32" Alias _FuncName_SendDlgItemMessage (hwnd As HWND, id As DWord, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
     23Declare Function _System_SendMessage Lib "user32" Alias "SendMessageA" (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
     24Declare Function _System_PostMessage Lib "user32" Alias "PostMessageA" (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
     25Declare Function _System_SendDlgItemMessage Lib "user32" Alias "SendDlgItemMessageA" (hwnd As HWND, id As DWord, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
    4426Declare Function _System_GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (hwnd As HWND, pdwProcessId As *DWord) As DWord
    4527
     
    5032Class WindowHandle
    5133    hwnd As HWND
     34Private
     35    Sub ThrowIfFailedNT(ret As BOOL, msg As String)
     36        If ret = FALSE Then
     37            ThrowWithLastErrorNT(msg)
     38        End If
     39    End Sub
    5240Public
    5341    Sub WindowHandle()
     
    7462    End Function
    7563*/
    76     Function BringToTop() As Boolean
    77         Return BringWindowToTop(hwnd) As Boolean
    78     End Function
    79 
    80     Function BeginPaint(ByRef ps As PAINTSTRUCT) As HDC
    81         Return _System_BeginPaint(hwnd, ps)
    82     End Function
    83 
    84     Function BeginPaint() As PAINTSTRUCT
    85         _System_BeginPaint(hwnd, BeginPaint)
    86     End Function
    87 /*
    88     Const Function ChildFromPoint(x As Long, y As Long) As WindowHandle
    89         Return New WindowHandle(ChildWindowFromPoint(hwnd, x, y))
    90     End Function
    91 
    92     Const Function ChildFromPointEx(x As Long, y As Long, flags As DWord) As WindowHandle
    93         Return New WindowHandle(ChildWindowFromPointEx(hwnd, x, y, flags))
    94     End Function
    95 */
    96     Const Function ClientToScreen(ByRef pt As POINTAPI) As Boolean
    97         Return _System_ClientToScreen(hwnd, pt) As Boolean
    98     End Function
    99 
    100     Const Function ClientToScreen(ByRef rc As RECT) As Boolean
    101         Dim ppt = VarPtr(rc) As *POINTAPI
    102         Return (_System_ClientToScreen(hwnd, ppt[0]) <> FALSE And _System_ClientToScreen(hwnd, ppt[1]) <> FALSE) As Boolean
    103     End Function
    104 
    105     Function Close() As Boolean
    106         Return CloseWindow(hwnd) As Boolean
    107     End Function
    108 
    109     Function CreateCaret(hbmp As HBITMAP, width As Long, height As Long) As Boolean
    110         Return _System_CreateCaret(hwnd, hbmp, width, height) As Boolean
    111     End Function
    112 
    113     Function Destroy() As Boolean
    114         Return DestroyWindow(hwnd) As Boolean
    115     End Function
    116 
    117     Function DrawMenuBar() As Boolean
    118         Return _System_DrawMenuBar(hwnd) As Boolean
    119     End Function
    120 /*
    121     Function EnableScrollBar(SBFlags As DWord, arrows As DWord) As Boolean
    122         Return EnableScrollBar(hwnd, SBFlags, arrows) As Boolean
    123     End Function
    124 */
    125     Function Enable(enable As Boolean) As Boolean
    126         Return EnableWindow(hwnd, enable) As Boolean
    127     End Function
    128 
    129     Function EndPaint(ByRef ps As PAINTSTRUCT) As Boolean
    130         Return _System_EndPaint(hwnd, ps) As Boolean
    131     End Function
    132 
    133     Const Function EnumChilds(enumFunc As WNDENUMPROC, lp As LPARAM) As Boolean
    134         Return EnumChildWindows(hwnd, enumFunc, lp) As Boolean
    135     End Function
    136 
    137     Function Flash(invert As Boolean) As Boolean
    138         Return FlashWindow(hwnd, invert) As Boolean
    139     End Function
    140 
    141     Const Function GetClassLongPtr(index As Long) As LONG_PTR
    142         Return _System_GetClassLongPtr(hwnd, index)
    143     End Function
    144 
    145     Const Function GetClassName(className As PTSTR, maxCount As Long) As Long
    146         Return _System_GetClassName(hwnd, className, maxCount)
    147     End Function
    148 
    149 /*
    150     Const Function GetContextHelpId() As DWord
    151         Return GetWindowContextHelpId(hwnd)
    152     End Function
    153 */
    154     Function GetDC() As HDC
    155         Return _System_GetDC(hwnd)
    156     End Function
    157 
    158     Function GetDCEx(hrgnClip As HRGN, flags As DWord) As HDC
    159         Return _System_GetDCEx(hwnd, hrgnClip, flags)
    160     End Function
    161 /*
    162     Const Function GetDlgCtrlID() As Long
    163         Return GetDlgCtrlID(hwnd)
    164     End Function
    165 
    166     Const Function GetDlgItem(idDlgItem As Long) As WindowHandle
    167         Return GetDlgItem(hwnd, idDlgItem)
    168     End Function
    169 
    170     Const Function GetDlgItemText(idDlgItem As Long, ps As PTSTR, maxCount As Long) As Long
    171         Return GetDlgItemText(hwnd, idDlgItem, ps, maxCount)
    172     End Function
    173 */
    174     Const Function GetMenu() As HMENU
    175         Return _System_GetMenu(hwnd)
    176     End Function
    177 /*
    178     Const Function GetParent() As WindowHandle
    179         Return New WindowHandle(_System_GetParent(hwnd))
    180     End Function
    181 */
    182     Const Function GetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO) As Boolean
    183         Return _System_GetScrollInfo(hwnd, fnBar, si) As Boolean
    184     End Function
    185 /*
    186     Const Function GetSystemMenu(revert As Boolean) As HMENU
    187         Return GetSystemMenu(hwnd, revert)
    188     End Function
    189 
    190     Const Function GetUpdateRect(ByRef rc As RECT, erase As Boolean) As Boolean
    191         Return GetUpdateRact(hwnd, rc, erase) As Boolean
    192     End Function
    193 
    194     Const Function GetUpdateRgn(hrgn As HRGN, erase As Boolean) As Boolean
    195         Return GetUpdateRgn(hwnd, hrgn, erase) As Boolean
    196     End Function
    197 
    198     Const Function GetWindow(cmd As DWord) As WindowHandle
    199         Return GetWindow(hwnd, cmd)
    200     End Function
    201 */
    202     Function GetWindowDC() As HDC
    203         Return _System_GetWindowDC(hwnd)
    204     End Function
    205 
    206     Const Function GetWindowLongPtr(index As Long) As LONG_PTR
    207         Return _System_GetWindowLongPtr(hwnd, index)
    208     End Function
    209 /*
    210     Const Function GetWindowPlasement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
    211         Return GetWindowPlasement(hwnd, wndpl) As Boolean
    212     End Function
    213 */
    214     Const Function GetText(ps As PTSTR, maxCount As Long) As Boolean
    215         Return GetWindowText(hwnd, ps, maxCount) As Boolean
    216     End Function
    217 
    218     Const Function GetWindowThreadProcessId(ByRef processId As DWord) As DWord
    219         Return _System_GetWindowThreadProcessId(hwnd, VarPtr(processId))
    220     End Function
    221 
    222     Function HideCaret() As Boolean
    223         Return _System_HideCaret(hwnd) As Boolean
    224     End Function
    225 
    226     Function InvalidateRect(ByRef rc As RECT, erace As Boolean) As Boolean
    227         Return _System_InvalidateRect(hwnd, rc, erace) As Boolean
    228     End Function
    229 
    230     Function InvalidateRect(ByRef rc As RECT) As Boolean
    231         Return _System_InvalidateRect(hwnd, rc, TRUE) As Boolean
    232     End Function
    233 
    234     Function InvalidateRgn(hrgn As HRGN, erace As Boolean) As Boolean
    235         Return _System_InvalidateRgn(hwnd, hrgn, erace) As Boolean
    236     End Function
    237 
    238     Function InvalidateRgn(hrgn As HRGN) As Boolean
    239         Return _System_InvalidateRgn(hwnd, hrgn, TRUE) As Boolean
    240     End Function
    241 
    242     Function Invalidate(erace As Boolean) As Boolean
    243         Return _System_InvalidateRect(hwnd, ByVal 0, erace) As Boolean
    244     End Function
    245 
    246     Function Invalidate() As Boolean
    247         Return _System_InvalidateRect(hwnd, ByVal 0, TRUE) As Boolean
    248     End Function
    249 /*
    250     Const Function IsChild(hwnd As HWND) As Boolean
    251         Return IsChild(This.hwnd, hwnd) As Boolean
    252     End Function
    253 
    254     Const Function IsDialogMessage(ByRef msg As MSG) As Boolean
    255         Return IsDialogMessage(hwnd, msg) As Boolean
    256     End Function
    257 */
    258     Const Function IsIconic() As Boolean
    259         Return _System_IsIconic(hwnd) As Boolean
    260     End Function
    261 
    262     Const Function IsWindow() As Boolean
    263         Return _System_IsWindow(hwnd) As Boolean
    264     End Function
    265 
    266     Const Function IsEnabled() As Boolean
    267         Return IsWindowEnabled(hwnd) As Boolean
    268     End Function
    269 
    270     Const Function IsUnicode() As Boolean
    271         Return IsWindowUnicode(hwnd) As Boolean
    272     End Function
    273 
    274     Const Function IsVisible() As Boolean
    275         Return IsWindowVisible(hwnd) As Boolean
    276     End Function
    277 /*
    278     Const Function IsZoomed() As Boolean
    279         Return IsZoomed(hwnd) As Boolean
    280     End Function
    281 
    282     Function KillTimer(idEvent As ULONG_PTR) As Boolean
    283         Return KillTimer(idEvent) As Boolean
    284     End Function
    285 */
    286     Function LockUpdate() As Boolean
    287         Return LockWindowUpdate(hwnd) As Boolean
    288     End Function
    289 /*
    290     Function MapPoints(hwndTo As HWND, pPoints As *POINTAPI, cPoints As DWord) As Long
    291         Return MapWindowPoints(hwnd, hwndTo, pPoints, cPoints)
    292     End Function
    293 
    294     Function MapPoints(hwndTo As HWND, ByRef rc As RECT) As Long
    295         Return MapWindowPoints(hwnd, hwndTo, VarPtr(rc) As *POINTAPI, 2)
    296     End Function
    297 
    298     Const Function MessageBox(text As PCTSTR, caption As PCTSTR, uType As DWord) As Long
    299         Return MessageBox(hwnd, text, caption, uType)
    300     End Function
    301 
    302     Const Function MessageBox(text As PCTSTR, caption As PCTSTR) As Long
    303         Return MessageBox(hwnd, text, caption, MB_OK)
    304     End Function
    305 
    306     Const Function MessageBox(text As PCTSTR) As Long
    307         Return MessageBox(hwnd, text, 0, MB_OK)
    308     End Function
    309 */
    310     Function Move(x As Long, y As Long, width As Long, height As Long, repaint = True As Boolean) As Boolean
    311         Return MoveWindow(hwnd, x, y, width, height, repaint) As Boolean
    312     End Function
    313 
    314     Function Move(ByRef rc As RECT, repaint = True As Boolean) As Boolean
     64    Sub BringToTop()
     65        ThrowIfFailedNT(BringWindowToTop(hwnd), "WindowHandle.BringToTop")
     66    End Sub
     67
     68'座標関係
     69    Const Function ClientToScreen(ByRef pt As POINTAPI) As POINTAPI
     70        ClientToScreen = pt
     71        ThrowIfFailedNT(_System_ClientToScreen(hwnd, ClientToScreen), "WindowHandle.ClientToScreen")
     72    End Function
     73
     74    Const Function ClientToScreen(ByRef rc As RECT) As RECT
     75        ClientToScreen = rc
     76        Dim ppt = VarPtr(ClientToScreen) As *POINTAPI
     77        ThrowIfFailedNT(_System_ClientToScreen(hwnd, ppt[0]), "WindowHandle.ClientToScreen")
     78        ThrowIfFailedNT(_System_ClientToScreen(hwnd, ppt[1]), "WindowHandle.ClientToScreen")
     79    End Function
     80
     81    Const Function ScreenToClient(ByRef pt As POINTAPI) As POINTAPI
     82        ScreenToClient = pt
     83        ThrowIfFailedNT(_System_ScreenToClient(hwnd, ScreenToClient), "WindowHandle.ScreenToClient")
     84    End Function
     85
     86    Const Function ScreenToClient(ByRef rc As RECT) As RECT
     87        ScreenToClient = rc
     88        Dim ppt = VarPtr(ScreenToClient) As *POINTAPI
     89        ThrowIfFailedNT(_System_ScreenToClient(hwnd, ppt[0]), "WindowHandle.ClientToScreen")
     90        ThrowIfFailedNT(_System_ScreenToClient(hwnd, ppt[1]), "WindowHandle.ClientToScreen")
     91    End Function
     92
     93    Sub Move(x As Long, y As Long, width As Long, height As Long, repaint = True As Boolean)
     94        ThrowIfFailedNT(MoveWindow(hwnd, x, y, width, height, repaint), "WindowHandle.Move")
     95    End Sub
     96
     97    Sub Move(ByRef rc As RECT, repaint = True As Boolean)
    31598        With rc
    316             Return MoveWindow(hwnd, .left, .top, .right - .left, .bottom - .top, repaint) As Boolean
     99            Move(.left, .top, .right - .left, .bottom - .top, repaint)
    317100        End With
    318     End Function
    319 
    320 /*
    321     Function OpenClipboard() As Boolean
    322         Return OpenClipboard(hwnd) As Boolean
    323     End Function
    324 
    325     Function OpenIcon() As Boolean
    326         Return OpenIcon(hwnd) As Boolean
    327     End Function
    328 */
    329     Function PostMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As Boolean
    330         Return _System_PostMessage(hwnd, msg, wp, lp) As Boolean
    331     End Function
    332 
    333     Function PostMessage(msg As DWord) As Boolean
    334         Return _System_PostMessage(hwnd, msg, 0, 0) As Boolean
    335     End Function
    336 /*
    337     Function RedrawWindow(ByRef rcUpdate As RECT, hrgnUpdate As HRGN, flags As DWord) As Boolean
    338         Return RedrawWindow(hwnd, rcUpdatre, hrgnUpdate, flags) As Boolean
    339     End Function
    340 */
    341     Function ReleaseDC(hdc As HDC) As Boolean
    342         Return _System_ReleaseDC(hwnd, hdc) As Boolean
    343     End Function
    344 /*
    345     Function RemoveProp(str As String) As HANDLE
    346         Return RemoveProp(hwnd, ToTCStr(str))
    347     End Function
    348 
    349     Function RemoveProp(psz As PCTSTR) As HANDLE
    350         Return RemoveProp(hwnd, psz)
    351     End Function
    352 
    353     Function RemoveProp(atom As ATOM) As HANDLE
    354         Return RemoveProp(hwnd, atom As ULONG_PTR As PCTSTR)
    355     End Function
    356 */
    357     Const Function ScreenToClient(ByRef pt As POINTAPI) As Boolean
    358         Return _System_ScreenToClient(hwnd, pt) As Boolean
    359     End Function
    360 
    361     Const Function ScreenToClient(ByRef rc As RECT) As Boolean
    362         Dim ppt = VarPtr(rc) As *POINTAPI
    363         Return (_System_ScreenToClient(hwnd, ppt[0]) <> FALSE And _System_ScreenToClient(hwnd, ppt[1]) <> FALSE) As Boolean
    364     End Function
    365 
    366     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
    367         Return ScrollWindowEx(hwnd, dx, dy, rcScroll, rcClip, hrgnUpdate, rcUpdate, flags) As Boolean
    368     End Function
    369 
    370     Function SendDlgItemMessage(idDlgItem As Long, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
    371         Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, wp, lp)
    372     End Function
    373 
    374     Function SendDlgItemMessage(idDlgItem As Long, msg As DWord) As LRESULT
    375         Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, 0, 0)
    376     End Function
    377 
    378     Function SendMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
    379         Return _System_SendMessage(hwnd, msg, wp, lp)
    380     End Function
    381 
    382     Function SendMessage(msg As DWord) As LRESULT
    383         Return _System_SendMessage(hwnd, msg, 0, 0)
    384     End Function
    385 /*
    386     Function SetActiveWindow() As WindowHandle
    387         Return New WindowHandle(SetActiveWindow(hwnd))
    388     End Function
    389 
    390     Function SetDlgItemText(idDlgItem As Long, psz As PCTSTR) As Boolean
    391         Return SetDlgItemText(hwnd, idDlgItem, psz) As Boolean
    392     End Function
    393 
    394     Function SetCapture() As WindowHandle
    395         Return New WindowHandle(SetCapture(hwnd))
    396     End Function
    397 */
    398     Function SetClassLongPtr(index As Long, newLong As LONG_PTR) As LONG_PTR
    399         Return _System_SetClassLongPtr(hwnd, index, newLong)
    400     End Function
    401 /*
    402     Function SetFocus() As WindowHandle
    403         Return New WindowHandle(SetFocus(hwnd))
    404     End Function
    405 */
    406     Function SetForeground() As Boolean
    407         Return SetForegroundWindow(hwnd) As Boolean
    408     End Function
    409 
    410     Function SetMenu(hmenu As HMENU) As Boolean
    411         Return _System_SetMenu(hwnd, hmenu) As Boolean
    412     End Function
    413 
    414     Function SetParent(hwndNewParent As HWND) As WindowHandle
    415         Return New WindowHandle(_System_SetParent(hwnd, hwndNewParent))
    416     End Function
    417 
    418     Function SetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO, redraw As Boolean) As Boolean
    419         Return _System_SetScrollInfo(hwnd, fnBar, si, redraw) As Boolean
    420     End Function
    421 
    422     Function SetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO) As Boolean
    423         Return _System_SetScrollInfo(hwnd, fnBar, si, TRUE) As Boolean
    424     End Function
    425 /*
    426     Function SetTimer(idEvent As ULONG_PTR, elapse As DWord, timerFunc As TIMERPROC) As ULONG_PTR
    427         Return SetTmer(hwnd, idEvent, elapse, timerFunc)
    428     End Function
    429 
    430     Function SetTimer(idEvent As ULONG_PTR, elapse As DWord) As ULONG_PTR
    431         Return This.SetTmer(hwnd, idEvent, elapse, 0)
    432     End Function
    433 
    434     Function SetContextHelpId(contextHelpId As DWord) As Boolean
    435         Return SetContextHelpId(hwnd, contextHelpId) As Boolean
    436     End Function
    437 */
    438     Function SetWindowLongPtr(index As Long, newLong As LONG_PTR) As LONG_PTR
    439         Return _System_SetWindowLongPtr(hwnd, index, newLong)
    440     End Function
    441 /*
    442     Function SetWindowPlacement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
    443         Return SetWindowPlacement(hwnd, wndpl) As Boolean
    444     End Function
    445 */
    446     Function SetPos(hwndInsertAfter As HWND, x As Long, y As Long, cx As Long, cy As Long, flags As DWord) As Boolean
    447         Return SetWindowPos(hwnd, hwndInsertAfter, x, y, cx, cy, flags) As Boolean
    448     End Function
    449 
    450     Function SetPos(hwndInsertAfter As HWND, ByRef rc As RECT, flags As DWord) As Boolean
     101    End Sub
     102
     103    Sub SetPos(hwndInsertAfter As HWND, x As Long, y As Long, cx As Long, cy As Long, flags As DWord)
     104        ThrowIfFailedNT(SetWindowPos(hwnd, hwndInsertAfter, x, y, cx, cy, flags), "WindowHandle.SetPos")
     105    End Sub
     106
     107    Sub SetPos(hwndInsertAfter As HWND, ByRef rc As RECT, flags As DWord)
    451108        With rc
    452             Return SetWindowPos(hwnd, hwndInsertAfter, .left, .top, .right - .left, .bottom - .top, flags) As Boolean
     109            SetPos(hwndInsertAfter, .left, .top, .right - .left, .bottom - .top, flags)
    453110        End With
    454     End Function
    455 
    456     Function SetRgn(hrgn As HRGN, redraw As Boolean) As Boolean
    457         Return SetWindowRgn(hwnd, hrgn, redraw) As Boolean
    458     End Function
    459 
    460     Function SetRgn(hrgn As HRGN) As Boolean
    461         Return SetWindowRgn(hwnd, hrgn, TRUE) As Boolean
    462     End Function
    463 
    464     Function ShowCaret() As Boolean
    465         Return _System_ShowCaret(hwnd) As Boolean
    466     End Function
    467 /*
    468     Function ShowScrollBar(bar As DWord, show As Boolean) As Boolean
    469         Return ShowScrollBar(hwnd, bar, show) As Boolean
    470     End Function
    471 
    472     Function ShowScrollBar(bar As DWord) As Boolean
    473         Return ShowScrollBar(hwnd, bar, TRUE) As Boolean
    474     End Function
    475 */
    476     Function Show(cmdShow As DWord) As Boolean
    477         Return ShowWindow(hwnd, cmdShow) As Boolean
    478     End Function
    479 
    480     Function ShowAsync(cmdShow As DWord) As Boolean
    481         Return ShowWindowAsync(hwnd, cmdShow) As Boolean
    482     End Function
    483 
    484     Function Update() As Boolean
    485         Return UpdateWindow(hwnd) As Boolean
    486     End Function
    487 
    488     Function ValidateRect(ByRef rc As RECT) As Boolean
    489         Return _System_ValidateRect(hwnd, rc) As Boolean
    490     End Function
    491 
    492     Function ValidateRgn(hrgn As HRGN) As Boolean
    493         Return _System_ValidateRgn(hwnd, hrgn) As Boolean
    494     End Function
    495 
    496     Function Validate() As Boolean
    497         Return _System_ValidateRect(hwnd, ByVal 0) As Boolean
    498     End Function
    499 
    500     ' Propaties
     111    End Sub
    501112
    502113    Const Function ClientRect() As RECT
    503         GetClientRect(hwnd, ClientRect)
     114        ThrowIfFailedNT(GetClientRect(hwnd, ClientRect), "WindowHandle.ClientRect")
    504115    End Function
    505116#ifdef _UNDEF
     
    516127#endif
    517128    Const Function WindowRect() As RECT
    518         _System_GetWindowRect(hwnd, WindowRect)
     129        GetWindowRect(hwnd, WindowRect)
    519130    End Function
    520131
     
    522133        This.Move(rc)
    523134    End Sub
    524 #ifdef _UNDEF
    525     Const Function ContextHelpID() As DWord
    526         Return GetContextHelpId(hwnd)
    527     End Function
    528 
    529     Sub ContextHelpID(newID As DWord)
    530         _System_SetContextHelpId(hwnd, newId)
    531     End Sub
    532 
    533     Const Function DlgCtrlID() As Long
    534         Return GetDlgCtrlID(hwnd)
    535     End Function
    536 
    537     Sub DlgCtrlId(newId As Long)
    538         _System_SetWindowLongPtr(hwnd, GWLP_ID, newId)
    539     End Sub
    540 #endif
    541     Function DlgItem(idDlgItem As Long) As WindowHandle
    542         Dim w As WindowHandle(GetDlgItem(hwnd, idDlgItem))
    543         Return w
    544     End Function
    545 
    546     Const Function ExStyle() As DWord
    547         Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
    548     End Function
    549 
    550     Sub ExStyle(newExStyle As DWord)
    551         _System_SetWindowLongPtr(hwnd, GWL_EXSTYLE, newExStyle)
    552     End Sub
    553 
    554     Const Function Style() As DWord
    555         Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
    556     End Function
    557 
    558     Sub Style(newStyle As DWord)
    559         _System_SetWindowLongPtr(hwnd, GWL_STYLE, newStyle)
    560     End Sub
    561 
    562     Const Function Enabled() As Boolean
    563         Return IsWindowEnabled(hwnd) As Boolean
    564     End Function
    565 
    566     Sub Enabled(enable As Boolean)
    567         EnableWindow(hwnd, enable)
    568     End Sub
    569 
    570     Const Function Font() As HFONT
    571         Return _System_SendMessage(hwnd, WM_GETFONT, 0, 0) As HFONT
    572     End Function
    573 
    574     Sub Font(hfntNew As HFONT)
    575         _System_SendMessage(hwnd, WM_SETFONT, hfntNew As WPARAM, TRUE)
    576     End Sub
    577 
    578     Const Function Maximized() As Boolean
    579         Return IsZoomed(hwnd) As Boolean
    580     End Function
    581 
    582     Sub Maximized(maximized As Boolean)
    583         If maximized <> False Then
    584             ShowWindow(hwnd, SW_SHOWMAXIMIZED)
    585         Else
    586             ShowWindow(hwnd, SW_RESTORE)
    587         End If
    588     End Sub
    589 
    590     Const Function Minimized() As Boolean
    591         Return _System_IsIconic(hwnd) As Boolean
    592     End Function
    593 
    594     Sub Minimized(minimized As Boolean)
    595         If minimized <> False Then
    596             CloseWindow(hwnd)
    597         Else
    598             OpenIcon(hwnd)
    599         End If
    600     End Sub
    601 
    602     Const Function Instance() As HINSTANCE
    603         Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
    604     End Function
    605 
    606     ' IsWindow, IsUnicodeはメソッドと同じ。
    607 
    608     Const Function Parent() As WindowHandle
    609         Return New WindowHandle(_System_GetParent(hwnd))
    610     End Function
    611 
    612     Sub Parent(hwndNewParent As HWND)
    613         _System_SetParent(hwnd, hwndNewParent)
    614     End Sub
     135
     136    Const Function WindowPlacement() As WINDOWPLACEMENT
     137        WindowPlacement.length = Len(WindowPlacement)
     138        ThrowIfFailedNT(GetWindowPlacement(hwnd, WindowPlacement), "WindowHandle.WindowPlacement (get)")
     139    End Function
     140
     141    Sub WindowPlacement(ByRef wndpl As WINDOWPLACEMENT)
     142        ThrowIfFailedNT(SetWindowPlacement(hwnd, wndpl), "WindowHandle.WindowPlacement (set)")
     143    End Sub
     144
     145'キャレット
     146    Sub CreateCaret(hbmp As HBITMAP, width As Long, height As Long)
     147        ThrowIfFailedNT(_System_CreateCaret(hwnd, hbmp, width, height), "WindowHandle.CreateCaret")
     148    End Sub
     149
     150    Sub HideCaret()
     151        ThrowIfFailedNT(_System_HideCaret(hwnd), "WindowHandle.HideCaret")
     152    End Sub
     153
     154    Sub ShowCaret()
     155        ThrowIfFailedNT(_System_ShowCaret(hwnd), "WindowHandle.ShowCaret")
     156    End Sub
     157'全般
     158    Sub Destroy()
     159        DestroyWindow(hwnd)
     160    End Sub
     161
    615162
    616163    Const Function ProcessId() As DWord
     
    621168        Return GetWindowThreadProcessId(ByVal 0)
    622169    End Function
    623 
    624     Const Function Menu() As HMENU
    625         Return _System_GetMenu(hwnd)
    626     End Function
    627 
    628     Sub Menu(hmenuNew As HMENU)
    629         _System_SetMenu(hwnd, hmenuNew)
    630     End Sub
    631170
    632171    Const Function Prop(str As String) As HANDLE
     
    674213        Return GetWindowTextLength(hwnd)
    675214    End Function
    676 #ifdef _UNDEF
    677     Const Function UserData() As LONG_PTR
    678         Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)
    679     End Function
    680 
    681     Sub UserData(newValue As LONG_PTR)
    682         _System_SetWindowLongPtr(hwnd, GWLP_USERDATA, newValue)
    683     End Sub
    684 #endif
     215
     216    Function Flash(invert As Boolean) As Boolean
     217        Return FlashWindow(hwnd, invert) As Boolean
     218    End Function
     219/*
     220    Const Function GetWindow(cmd As DWord) As WindowHandle
     221        Return GetWindow(hwnd, cmd)
     222    End Function
     223    Const Function IsChild(hwnd As HWND) As Boolean
     224        Return IsChild(This.hwnd, hwnd) As Boolean
     225    End Function
     226
     227    Const Function IsDialogMessage(ByRef msg As MSG) As Boolean
     228        Return IsDialogMessage(hwnd, msg) As Boolean
     229    End Function
     230*/
     231    Const Function IsValid() As Boolean
     232        Return IsWindow(hwnd) As Boolean
     233    End Function
     234
     235    Const Function IsUnicode() As Boolean
     236        Return IsWindowUnicode(hwnd) As Boolean
     237    End Function
     238/*
     239    Function KillTimer(idEvent As ULONG_PTR) As Boolean
     240        Return KillTimer(idEvent) As Boolean
     241    End Function
     242
     243    Function SetTimer(idEvent As ULONG_PTR, elapse As DWord, timerFunc As TIMERPROC) As ULONG_PTR
     244        Return SetTmer(hwnd, idEvent, elapse, timerFunc)
     245    End Function
     246
     247    Function SetTimer(idEvent As ULONG_PTR, elapse As DWord) As ULONG_PTR
     248        Return This.SetTmer(hwnd, idEvent, elapse, 0)
     249    End Function
     250
     251    Function SetActiveWindow() As WindowHandle
     252        Return New WindowHandle(SetActiveWindow(hwnd))
     253    End Function
     254
     255    Function SetCapture() As WindowHandle
     256        Return New WindowHandle(SetCapture(hwnd))
     257    End Function
     258 
     259    Function SetFocus() As WindowHandle
     260        Return New WindowHandle(SetFocus(hwnd))
     261    End Function
     262*/
     263    Function SetForeground() As Boolean
     264        Return SetForegroundWindow(hwnd) As Boolean
     265    End Function
     266
     267    Const Function ContextHelpID() As DWord
     268        Return GetWindowContextHelpId(hwnd)
     269    End Function
     270
     271    Sub ContextHelpID(newId As DWord)
     272        ThrowIfFailedNT(SetWindowContextHelpId(hwnd, newId), "WindowHandle.ContextHelpID")
     273    End Sub
     274'表示関係
     275    '呼出前に可視状態だったらTrue、そうでなければFalseが返る。
     276    Function Show(cmdShow As DWord) As Boolean
     277        Return ShowWindow(hwnd, cmdShow) As Boolean
     278    End Function
     279
     280    Function ShowAsync(cmdShow As DWord) As Boolean
     281        Return ShowWindowAsync(hwnd, cmdShow) As Boolean
     282    End Function
     283
    685284    Const Function Visible() As Boolean
    686285        Return IsWindowVisible(hwnd) As Boolean
     
    694293        EndIf
    695294    End Sub
     295
     296    Const Function Maximized() As Boolean
     297        Return IsZoomed(hwnd) As Boolean
     298    End Function
     299
     300    Sub Maximized(maximized As Boolean)
     301        If maximized <> False Then
     302            Show(SW_SHOWMAXIMIZED)
     303        Else
     304            Show(SW_RESTORE)
     305        End If
     306    End Sub
     307
     308    Const Function Minimized() As Boolean
     309        Return IsIconic(hwnd) As Boolean
     310    End Function
     311
     312    Sub Minimized(minimized As Boolean)
     313        If minimized <> False Then
     314            CloseWindow(hwnd)
     315        Else
     316            OpenIcon(hwnd)
     317        End If
     318    End Sub
     319
     320    Const Function Enable() As Boolean
     321        Return IsWindowEnabled(hwnd) As Boolean
     322    End Function
     323
     324    Sub Enable(enable As Boolean)
     325        EnableWindow(hwnd, enable)
     326    End Sub
     327
     328'メニュー
     329/*
     330    Sub DrawMenuBar()
     331        ThrowIfFailedNT(_System_DrawMenuBar(hwnd), "WindowHandle.DrawMenuBar")
     332    End Sub
     333    Const Function GetMenu() As HMENU
     334        Return _System_GetMenu(hwnd)
     335    End Function
     336
     337    Sub SetMenu(hmenu As HMENU)
     338        ThrowIfFailedNT(_System_SetMenu(hwnd, hmenu), "WindowHandle.SetMenu")
     339    End Sub
     340*/
     341    Const Function GetWindowThreadProcessId(ByRef processId As DWord) As DWord
     342        Return _System_GetWindowThreadProcessId(hwnd, VarPtr(processId))
     343    End Function
     344
     345'スクロールバー
     346/*
     347    Function EnableScrollBar(SBFlags As DWord, arrows As DWord) As Boolean
     348        Return EnableScrollBar(hwnd, SBFlags, arrows) As Boolean
     349    End Function
     350
     351    Const Function GetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO) As Boolean
     352        Return _System_GetScrollInfo(hwnd, fnBar, si) As Boolean
     353    End Function
     354
     355    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 Long
     356        Return ScrollWindowEx(hwnd, dx, dy, rcScroll, rcClip, hrgnUpdate, rcUpdate, flags)
     357    End Function
     358
     359    Function SetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO, redraw = True As Boolean) As Long
     360        Return _System_SetScrollInfo(hwnd, fnBar, si, redraw)
     361    End Function
     362
     363    Function ShowScrollBar(bar As DWord, show As Boolean) As Boolean
     364        Return ShowScrollBar(hwnd, bar, show) As Boolean
     365    End Function
     366
     367    Function ShowScrollBar(bar As DWord) As Boolean
     368        Return ShowScrollBar(hwnd, bar, TRUE) As Boolean
     369    End Function
     370*/
     371'子ウィンドウ
     372    Const Sub EnumChilds(enumFunc As WNDENUMPROC, lp As LPARAM)
     373        EnumChildWindows(hwnd, enumFunc, lp)
     374    End Sub
     375/*
     376    Const Function ChildFromPoint(x As Long, y As Long) As WindowHandle
     377        Return New WindowHandle(ChildWindowFromPoint(hwnd, x, y))
     378    End Function
     379
     380    Const Function ChildFromPointEx(x As Long, y As Long, flags As DWord) As WindowHandle
     381        Return New WindowHandle(ChildWindowFromPointEx(hwnd, x, y, flags))
     382    End Function
     383*/
     384'描画
     385    Function GetDC() As HDC
     386        Return _System_GetDC(hwnd)
     387    End Function
     388
     389    Function GetDCEx(hrgnClip As HRGN, flags As DWord) As HDC
     390        Return _System_GetDCEx(hwnd, hrgnClip, flags)
     391    End Function
     392
     393    Function GetWindowDC() As HDC
     394        Return _System_GetWindowDC(hwnd)
     395    End Function
     396
     397    Sub Invalidate(ByRef rc As RECT, erace As Boolean)
     398        ThrowIfFailedNT(InvalidateRect(hwnd, rc, erace), "WindowHandle.Invalidate")
     399    End Sub
     400
     401    Sub Invalidate(ByRef rc As RECT)
     402        ThrowIfFailedNT(InvalidateRect(hwnd, rc, TRUE), "WindowHandle.Invalidate")
     403    End Sub
     404
     405    Sub Invalidate(hrgn As HRGN, erace As Boolean)
     406        'InvalidateRgnは常に非0を返すというMSDNライブラリの記述を信じる
     407        InvalidateRgn(hwnd, hrgn, erace)
     408    End Sub
     409
     410    Sub Invalidate(hrgn As HRGN)
     411        InvalidateRgn(hwnd, hrgn, TRUE)
     412    End Sub
     413
     414    Sub Invalidate(erace As Boolean)
     415        ThrowIfFailedNT(InvalidateRect(hwnd, ByVal 0, erace), "WindowHandle.Invalidate")
     416    End Sub
     417
     418    Sub Invalidate()
     419        ThrowIfFailedNT(InvalidateRect(hwnd, ByVal 0, TRUE), "WindowHandle.Invalidate")
     420    End Sub
     421
     422    Sub Validate(ByRef rc As RECT)
     423        ThrowIfFailedNT(ValidateRect(hwnd, rc), "WindowHandle.Validate")
     424    End Sub
     425
     426    Sub Validate(hrgn As HRGN)
     427        ThrowIfFailedNT(ValidateRgn(hwnd, hrgn), "WindowHandle.Validate")
     428    End Sub
     429
     430    Sub Validate()
     431        ThrowIfFailedNT(ValidateRect(hwnd, ByVal 0), "WindowHandle.Validate")
     432    End Sub
     433
     434    Sub Update()
     435        ThrowIfFailedNT(UpdateWindow(hwnd), "WindowHandle.Update")
     436    End Sub
     437
     438    Sub Redraw(ByRef rcUpdate As RECT, hrgnUpdate As HRGN, flags As DWord)
     439        ThrowIfFailedNT(RedrawWindow(hwnd, rcUpdate, hrgnUpdate, flags), "WindowHandle.Update")
     440    End Sub
     441
     442    Sub ReleaseDC(hdc As HDC)
     443        ThrowIfFailedNT(_System_ReleaseDC(hwnd, hdc), "WindowHandle.ReleaseDC")
     444    End Sub
     445
     446    Sub SetRgn(hrgn As HRGN, redraw = True As Boolean)
     447        ThrowIfFailedNT(SetWindowRgn(hwnd, hrgn, redraw), "WindowHandle.SetRgn")
     448    End Sub
     449'メッセージ
     450    Function SendDlgItemMessage(idDlgItem As Long, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
     451        Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, wp, lp)
     452    End Function
     453
     454    Function SendDlgItemMessage(idDlgItem As Long, msg As DWord) As LRESULT
     455        Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, 0, 0)
     456    End Function
     457
     458    Function SendMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
     459        Return _System_SendMessage(hwnd, msg, wp, lp)
     460    End Function
     461
     462    Function SendMessage(msg As DWord) As LRESULT
     463        Return _System_SendMessage(hwnd, msg, 0, 0)
     464    End Function
     465
     466    Function PostMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As Boolean
     467        Return _System_PostMessage(hwnd, msg, wp, lp) As Boolean
     468    End Function
     469
     470    Function PostMessage(msg As DWord) As Boolean
     471        Return _System_PostMessage(hwnd, msg, 0, 0) As Boolean
     472    End Function
     473
     474'その他
     475    Const Function Id() As Long
     476        Return GetDlgCtrlID(hwnd)
     477    End Function
     478
     479    Sub Id(newId As Long)
     480        SetWindowLongPtr(hwnd, GWLP_ID, newId)
     481    End Sub
     482/*
     483    Function DlgItem(idDlgItem As Long) As WindowHandle
     484        DlgItem = New WindowHandle(GetDlgItem(hwnd, idDlgItem))
     485    End Function
     486*/
     487    Const Function ExStyle() As DWord
     488        Return GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
     489    End Function
     490
     491    Sub ExStyle(newExStyle As DWord)
     492        SetWindowLongPtr(hwnd, GWL_EXSTYLE, newExStyle As LONG_PTR)
     493    End Sub
     494
     495    Const Function Style() As DWord
     496        Return GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
     497    End Function
     498
     499    Sub Style(newStyle As DWord)
     500        SetWindowLongPtr(hwnd, GWL_STYLE, newStyle)
     501    End Sub
     502
     503    Const Function Font() As HFONT
     504        Return _System_SendMessage(hwnd, WM_GETFONT, 0, 0) As HFONT
     505    End Function
     506
     507    Sub Font(hfntNew As HFONT)
     508        _System_SendMessage(hwnd, WM_SETFONT, hfntNew As WPARAM, TRUE)
     509    End Sub
     510
     511    Const Function Instance() As HINSTANCE
     512        Return GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
     513    End Function
     514
     515    Const Function Parent() As WindowHandle
     516        Return New WindowHandle(GetParent(hwnd))
     517    End Function
     518
     519    Sub Parent(hwndNewParent As HWND)
     520        SetParent(hwnd, hwndNewParent)
     521    End Sub
     522
     523    Const Function UserData() As LONG_PTR
     524        Return GetWindowLongPtr(hwnd, GWLP_USERDATA)
     525    End Function
     526
     527    Sub UserData(newValue As LONG_PTR)
     528        SetWindowLongPtr(hwnd, GWLP_USERDATA, newValue)
     529    End Sub
     530
    696531#ifdef _UNDEF
    697     Const Function WindowPlacement() As WINDOWPLACEMENT
    698         WindowPlacement.length = Len(WindowPlacement)
    699         GetWindowPlacement(hwnd, WindowPlacement)
    700     End Function
    701 
    702     Sub WindowPlacement(ByRef wndpl As WINDOWPLACEMENT)
    703         SetWindowPlacement(wndpl)
    704     End Sub
    705 
    706532    Const Function WndProc() As WNDPROC
    707         Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As WNDPROC
     533        Return GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As WNDPROC
    708534    End Function
    709535
    710536    Sub WndProc(newWndProc As WNDPROC)
    711         _System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, newWndProc As LONG_PTR)
     537        SetWindowLongPtr(hwnd, GWLP_WNDPROC, newWndProc As LONG_PTR)
    712538    End Sub
    713539#endif
  • trunk/ab5.0/ablib/src/Classes/index.ab

    r635 r646  
    1010#require "./ActiveBasic/Windows/Registry.ab"
    1111#require "./ActiveBasic/Windows/Windows.ab"
    12 #require "./ActiveBasic/Windows/UI/WindowHandle.sbp"
     12#require "./ActiveBasic/Windows/UI/WindowHandle.ab"
    1313#require "./ActiveBasic/Windows/Version/Version.ab"
    1414#require "./ActiveBasic/Xml/Parser.ab"
Note: See TracChangeset for help on using the changeset viewer.