Ignore:
Timestamp:
Aug 24, 2007, 11:14:46 AM (17 years ago)
Author:
イグトランス (egtra)
Message:

フルコンパイルでのミスあぶり出し。註:修正は全て@300や@301以前に行われた。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/ActiveBasic/Windows/WindowHandle.sbp

    r302 r303  
    1 ' Windows/WindowHandle.sbp
    2 
    3 #ifndef __WINDOWS_WINDOWHANDLE_SBP__
    4 #define __WINDOWS_WINDOWHANDLE_SBP__
     1'Classes/ActiveBasic/Windows/WindowHandle.sbp
    52
    63#ifdef _WIN64
     
    1613#endif
    1714Declare Function _System_GetParent Lib "user32" Alias "GetParent" (hWnd As HWND) As HWND
    18 Declare Function _System_SetParent Lib "user32" Alias "SetParent" (hWnd As HWND) As HWND
     15Declare Function _System_SetParent Lib "user32" Alias "SetParent" (hWnd As HWND, hwndParent As HWND) As HWND
    1916Declare Function _System_GetMenu Lib "user32" Alias "GetMenu" (hWnd As HWND) As HMENU
    20 Declare Function _System_SetMenu Lib "user32" Alias "SetMenu" (hWnd As HWND) As HMENU
     17Declare Function _System_SetMenu Lib "user32" Alias "SetMenu" (hWnd As HWND, hmenu As HMENU) As HMENU
    2118Declare Function _System_InvalidateRect Lib "user32" Alias "InvalidateRect" (hWnd As HWND, ByRef Rect As RECT, bErase As BOOL) As BOOL
    2219Declare Function _System_InvalidateRgn Lib "user32" Alias "InvalidateRgn" (hWnd As HWND, hRgn As HRGN, bErase As BOOL) As BOOL
     
    3330Declare Function _System_GetWindowRect Lib "user32" Alias "DrawMenuBar" (hWnd As HWND, ByRef Rect As RECT) As BOOL
    3431Declare Function _System_IsWindow Lib "user32" Alias "IsWindow" (hWnd As HWND) As BOOL
    35 Declare Function _System_Isiconic Lib "user32" Alias "Isiconic" (hWnd As HWND) As BOOL
     32Declare Function _System_IsIconic Lib "user32" Alias "IsIconic" (hWnd As HWND) As BOOL
    3633Declare Function _System_GetClientRect Lib "user32" Alias "GetClientRect" (hWnd As HWND, ByRef Rect As RECT) As BOOL
    3734Declare Function _System_GetProp Lib "user32" Alias _FuncName_GetProp (hWnd As HWND, pString As PCTSTR) As HANDLE
     
    4138Declare Function _System_SetScrollInfo Lib "user32" Alias "SetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO, bRedraw As Long) As BOOL
    4239Declare Function _System_GetSystemMenu Lib "user32" Alias "GetSystemMenu" (hWnd As HWND, bRevert As BOOL) As HMENU
    43 Declare Function _System_GetDC Lib "gdi32" Alias "GetDC" (hwnd As HWND) As HDC
    44 Declare Function _System_ReleaseDC Lib "gdi32" Alias "ReleaseDC" (hwnd As HWND, hdc As HDC) As BOOL
     40Declare Function _System_GetDC Lib "user32" Alias "GetDC" (hwnd As HWND) As HDC
     41Declare Function _System_GetDCEx Lib "user32" Alias "GetDCEx" (hwnd As HWND, hrgnClip As HRGN, flags As DWord) As HDC
     42Declare Function _System_GetWindowDC Lib "user32" Alias "GetWindowDC" (hwnd As HWND) As HDC
     43Declare Function _System_ReleaseDC Lib "user32" Alias "ReleaseDC" (hwnd As HWND, hdc As HDC) As BOOL
     44Declare Function _System_SendMessage Lib "user32" Alias _FuncName_SendMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
     45Declare Function _System_PostMessage Lib "user32" Alias _FuncName_PostMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
     46Declare 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
     47Declare Function _System_GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (hwnd As HWND, pdwProcessId As *DWord) As DWord
     48
     49Namespace ActiveBasic
     50Namespace Windows
    4551
    4652Class WindowHandle
     
    5561    End Sub
    5662
    57     Sub WindowHandle(wnd As WindowHandle)
    58         hwnd = wnd.hwnd
    59     End Sub
    60 
    61     Sub Operator =(hwndNew As HWND)
    62         hwnd = hwndNew
    63     End Sub
    64 
    6563    Const Function HWnd() As HWND
    6664        Return hwnd
     
    7876        Return _System_BeginPaint(hwnd, ps)
    7977    End Function
    80 
     78/*
    8179    Const Function ChildFromPoint(x As Long, y As Long) As WindowHandle
    8280        Return New WindowHandle(ChildWindowFromPoint(hwnd, x, y))
     
    8684        Return New WindowHandle(ChildWindowFromPointEx(hwnd, x, y, flags))
    8785    End Function
    88 
     86*/
    8987    Const Function ClientToScreen(ByRef pt As POINTAPI) As Boolean
    9088        Return _System_ClientToScreen(hwnd, pt) As Boolean
     
    10199
    102100    Function CreateCaret(hbmp As HBITMAP, width As Long, height As Long) As Boolean
    103         Return _System_CreateCaret(hwnd, hbmp, width, hegiht) As Boolean
     101        Return _System_CreateCaret(hwnd, hbmp, width, height) As Boolean
    104102    End Function
    105103
     
    111109        Return _System_DrawMenuBar(hwnd) As Boolean
    112110    End Function
    113 
     111/*
    114112    Function EnableScrollBar(SBFlags As DWord, arrows As DWord) As Boolean
    115113        Return EnableScrollBar(hwnd, SBFlags, arrows) As Boolean
    116114    End Function
    117 
     115*/
    118116    Function Enable(enable As Boolean) As Boolean
    119117        Return EnableWindow(hwnd, enable) As Boolean
     
    137135
    138136    Const Function GetClassName(className As PTSTR, maxCount As Long) As Long
    139         Return _System_GetClassName(className, maxCount)
     137        Return _System_GetClassName(hwnd, className, maxCount)
    140138    End Function
    141139
     
    143141        Return _System_GetClientRect(hwnd, rc) As Boolean
    144142    End Function
    145 
     143/*
    146144    Const Function GetContextHelpId() As DWord
    147145        Return GetWindowContextHelpId(hwnd)
    148146    End Function
    149 
     147*/
    150148    Function GetDC() As HDC
    151149        Return _System_GetDC(hwnd)
     
    153151
    154152    Function GetDCEx(hrgnClip As HRGN, flags As DWord) As HDC
    155         Return GetDCEx(hwnd, hrgnClip, flags)
    156     End Function
    157 
     153        Return _System_GetDCEx(hwnd, hrgnClip, flags)
     154    End Function
     155/*
    158156    Const Function GetDlgCtrlID() As Long
    159157        Return GetDlgCtrlID(hwnd)
     
    167165        Return GetDlgItemText(hwnd, idDlgItem, ps, maxCount)
    168166    End Function
    169 
     167*/
    170168    Const Function GetMenu() As HMENU
    171169        Return _System_GetMenu(hwnd)
    172170    End Function
    173 
     171/*
    174172    Const Function GetParent() As WindowHandle
    175173        Return New WindowHandle(_System_GetParent(hwnd))
    176174    End Function
    177 
     175*/
    178176    Const Function GetProp(str As String) As HANDLE
    179177        Return _System_GetProp(hwnd, ToTCStr(str))
     
    191189        Return _System_GetScrollInfo(hwnd, fnBar, si) As Boolean
    192190    End Function
    193 
     191/*
    194192    Const Function GetSystemMenu(revert As Boolean) As HMENU
    195193        Return GetSystemMenu(hwnd, revert)
     
    207205        Return GetWindow(hwnd, cmd)
    208206    End Function
    209 
     207*/
    210208    Function GetWindowDC() As HDC
    211         Return GetWindowDC(hwnd)
     209        Return _System_GetWindowDC(hwnd)
    212210    End Function
    213211
     
    215213        Return _System_GetWindowLongPtr(hwnd, index)
    216214    End Function
    217 
     215/*
    218216    Const Function GetWindowPlasement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
    219217        Return GetWindowPlasement(hwnd, wndpl) As Boolean
    220218    End Function
    221 
     219*/
    222220    Const Function GetWindowRect(ByRef rc As RECT) As Boolean
    223         Return _System_GetWindowRect(rc) As Boolean
     221        Return _System_GetWindowRect(hwnd, rc) As Boolean
    224222    End Function
    225223
    226224    Const Function GetText(ps As PTSTR, maxCount As Long) As Boolean
    227         Return GetWindowText(ps, maxCount) As Boolean
     225        Return GetWindowText(hwnd, ps, maxCount) As Boolean
    228226    End Function
    229227
     
    233231
    234232    Const Function GetWindowThreadId() As DWord
    235         Return GetWindowProcessThreadId(hwnd, 0)
    236     End Function
    237 
    238     Const Function GetWindowProcessThreadId(ByRef processId As DWord) As DWord
    239         Return GetWindowProcessThreadId(hwnd, VarPtr(processId))
     233        Return _System_GetWindowThreadProcessId(hwnd, 0)
     234    End Function
     235
     236    Const Function GetWindowThreadProcessId(ByRef processId As DWord) As DWord
     237        Return _System_GetWindowThreadProcessId(hwnd, VarPtr(processId))
    240238    End Function
    241239
     
    267265        Return _System_InvalidateRect(hwnd, ByVal 0, TRUE) As Boolean
    268266    End Function
    269 
     267/*
    270268    Const Function IsChild(hwnd As HWND) As Boolean
    271269        Return IsChild(This.hwnd, hwnd) As Boolean
     
    275273        Return IsDialogMessage(hwnd, msg) As Boolean
    276274    End Function
    277 
     275*/
    278276    Const Function IsIconic() As Boolean
    279277        Return _System_IsIconic(hwnd) As Boolean
     
    295293        Return IsWindowVisible(hwnd) As Boolean
    296294    End Function
    297 
     295/*
    298296    Const Function IsZoomed() As Boolean
    299297        Return IsZoomed(hwnd) As Boolean
     
    303301        Return KillTimer(idEvent) As Boolean
    304302    End Function
    305 
     303*/
    306304    Function LockUpdate() As Boolean
    307305        Return LockWindowUpdate(hwnd) As Boolean
    308306    End Function
    309 
     307/*
    310308    Function MapPoints(hwndTo As HWND, pPoints As *POINTAPI, cPoints As DWord) As Long
    311309        Return MapWindowPoints(hwnd, hwndTo, pPoints, cPoints)
     
    327325        Return MessageBox(hwnd, text, 0, MB_OK)
    328326    End Function
    329 
     327*/
    330328    Function Move(x As Long, y As Long, width As Long, height As Long, repaint As Boolean) As Boolean
    331329        Return MoveWindow(hwnd, x, y, width, height, repaint) As Boolean
     
    336334    End Function
    337335
    338     Function Move(ByRef rc As RECT, repeaint As Boolean) As Boolean
     336    Function Move(ByRef rc As RECT, repaint As Boolean) As Boolean
    339337        With rc
    340338            Return MoveWindow(hwnd, .left, .top, .right - .left, .bottom - .top, repaint) As Boolean
     
    347345        End With
    348346    End Function
    349 
     347/*
    350348    Function OpenClipboard() As Boolean
    351349        Return OpenClipboard(hwnd) As Boolean
     
    355353        Return OpenIcon(hwnd) As Boolean
    356354    End Function
    357 
     355*/
    358356    Function PostMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As Boolean
    359         Return PostMessage(hwnd, msg, wp, lp) As Boolean
     357        Return _System_PostMessage(hwnd, msg, wp, lp) As Boolean
    360358    End Function
    361359
    362360    Function PostMessage(msg As DWord) As Boolean
    363         Return PostMessage(hwnd, msg, 0, 0) As Boolean
    364     End Function
    365 
     361        Return _System_PostMessage(hwnd, msg, 0, 0) As Boolean
     362    End Function
     363/*
    366364    Function RedrawWindow(ByRef rcUpdate As RECT, hrgnUpdate As HRGN, flags As DWord) As Boolean
    367365        Return RedrawWindow(hwnd, rcUpdatre, hrgnUpdate, flags) As Boolean
    368366    End Function
    369 
     367*/
    370368    Function ReleaseDC(hdc As HDC) As Boolean
    371369        Return _System_ReleaseDC(hwnd, hdc) As Boolean
    372370    End Function
    373 
     371/*
    374372    Function RemoveProp(str As String) As HANDLE
    375373        Return RemoveProp(hwnd, ToTCStr(str))
     
    383381        Return RemoveProp(hwnd, atom As ULONG_PTR As PCTSTR)
    384382    End Function
    385 
     383*/
    386384    Const Function ScreenToClient(ByRef pt As POINTAPI) As Boolean
    387385        Return _System_ScreenToClient(hwnd, pt) As Boolean
     
    398396
    399397    Function SendDlgItemMessage(idDlgItem As Long, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
    400         Return SendDlgItemMessage(hwnd, idDlgItem, wp, lp)
     398        Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, wp, lp)
    401399    End Function
    402400
    403401    Function SendDlgItemMessage(idDlgItem As Long, msg As DWord) As LRESULT
    404         Return SendDlgItemMessage(hwnd, idDlgItem, 0, 0)
     402        Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, 0, 0)
    405403    End Function
    406404
    407405    Function SendMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
    408         Return SendMessage(hwnd, msg, wp, lp)
     406        Return _System_SendMessage(hwnd, msg, wp, lp)
    409407    End Function
    410408
    411409    Function SendMessage(msg As DWord) As LRESULT
    412         Return SendMessage(hwnd, msg, 0, 0)
    413     End Function
    414 
     410        Return _System_SendMessage(hwnd, msg, 0, 0)
     411    End Function
     412/*
    415413    Function SetActiveWindow() As WindowHandle
    416414        Return New WindowHandle(SetActiveWindow(hwnd))
     
    424422        Return New WindowHandle(SetCapture(hwnd))
    425423    End Function
    426 
     424*/
    427425    Function SetClassLongPtr(index As Long, newLong As LONG_PTR) As LONG_PTR
    428426        Return _System_SetClassLongPtr(hwnd, index, newLong)
    429427    End Function
    430 
     428/*
    431429    Function SetFocus() As WindowHandle
    432430        Return New WindowHandle(SetFocus(hwnd))
    433431    End Function
    434 
     432*/
    435433    Function SetForeground() As Boolean
    436434        Return SetForegroundWindow(hwnd) As Boolean
     
    454452
    455453    Function SetProp(atom As ATOM, hData As HANDLE) As Boolean
    456         Return SetProp((atom As ULONG_PTR) As PCTSTR, hData) As Boolean
     454        Return This.SetProp((atom As ULONG_PTR) As PCTSTR, hData) As Boolean
    457455    End Function
    458456
     
    464462        Return _System_SetScrollInfo(hwnd, fnBar, si, TRUE) As Boolean
    465463    End Function
    466 
     464/*
    467465    Function SetTimer(idEvent As ULONG_PTR, elapse As DWord, timerFunc As TIMERPROC) As ULONG_PTR
    468466        Return SetTmer(hwnd, idEvent, elapse, timerFunc)
     
    470468
    471469    Function SetTimer(idEvent As ULONG_PTR, elapse As DWord) As ULONG_PTR
    472         Return SetTmer(hwnd, idEvent, elapse, 0)
     470        Return This.SetTmer(hwnd, idEvent, elapse, 0)
    473471    End Function
    474472
     
    476474        Return SetContextHelpId(hwnd, contextHelpId) As Boolean
    477475    End Function
    478 
     476*/
    479477    Function SetWindowLongPtr(index As Long, newLong As LONG_PTR) As LONG_PTR
    480478        Return _System_SetWindowLongPtr(hwnd, index, newLong)
    481479    End Function
    482 
     480/*
    483481    Function SetWindowPlacement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
    484482        Return SetWindowPlacement(hwnd, wndpl) As Boolean
    485483    End Function
    486 
     484*/
    487485    Function SetPos(hwndInsertAfter As HWND, x As Long, y As Long, cx As Long, cy As Long, flags As DWord) As Boolean
    488486        Return SetWindowPos(hwnd, hwndInsertAfter, x, y, cx, cy, flags) As Boolean
     
    514512        Return _System_ShowCaret(hwnd) As Boolean
    515513    End Function
    516 
     514/*
    517515    Function ShowScrollBar(bar As DWord, show As Boolean) As Boolean
    518516        Return ShowScrollBar(hwnd, bar, show) As Boolean
     
    522520        Return ShowScrollBar(hwnd, bar, TRUE) As Boolean
    523521    End Function
    524 
     522*/
    525523    Function Show(cmdShow As DWord) As Boolean
    526524        Return ShowWindow(hwnd, cmdShow) As Boolean
     
    556554        Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
    557555    End Function
    558 
     556#ifdef _UNDEF
    559557    Const Function GetWndProc() As WNDPROC
    560         Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As WNDPROC
    561     End Function
    562 
     558        Return _System_GetWindowLongPtr(hwnd, GWLP_WNDPROC) As WNDPROC
     559    End Function
     560#endif
    563561    Const Function GetInstance() As HINSTANCE
    564562        Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
     
    576574        Return _System_SetWindowLongPtr(hwnd, GWL_STYLE, style) As DWord
    577575    End Function
    578 
     576#ifdef _UNDEF
    579577    Function SetWndProc(wndProc As WNDPROC) As WNDPROC
    580         Return _System_SetWindowLongPtR(hwnd, GWLP_WNDPROC, wndProc As WNDPROC) As WNDPROC
    581     End Function
    582 
     578        Return _System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, wndProc As WNDPROC) As WNDPROC
     579    End Function
     580#endif
    583581    Function SetUserData(value As LONG_PTR) As LONG_PTR
    584         Return _System_SetWindowLongPtr(value As LONG_PTR)
     582        Return _System_SetWindowLongPtr(hwnd, GWLP_USERDATA, value As LONG_PTR)
    585583    End Function
    586584
     
    592590        Return rc
    593591    End Function
    594 
     592#ifdef _UNDEF
    595593    Sub ClientRect(ByRef rc As RECT)
    596594        Dim hasMenu As BOOL
    597         If IsChild() = False And IsMenu() <> False Then
     595        If IsChild() = False And GetMenu() <> 0 Then
    598596            hasMenu = TRUE
    599597        Else
     
    601599        End If
    602600        AdjustWindowRectEx(rc, GetStyle(), hasMenu, GetExStyle())
    603         MoveWindow(rc) ' WindowRect = rc
    604     End Sub
    605 
     601        This.Move(rc) ' WindowRect = rc
     602    End Sub
     603#endif
    606604    Const Function WindowRect() As RECT
    607605        Dim rc As RECT
     
    611609
    612610    Sub WindowRect(ByRef rc As RECT)
    613         MoveWindow(rc)
    614     End Sub
    615 
     611        This.Move(rc)
     612    End Sub
     613#ifdef _UNDEF
    616614    Const Function ContextHelpID() As DWord
    617615        Return GetContextHelpId(hwnd)
     
    634632        Return w
    635633    End Function
    636 
     634#endif
    637635    Const Function ExStyle() As DWord
    638636        Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
     
    640638
    641639    Sub ExStyle(newExStyle As DWord)
    642         _System_SetWindowLongPtr(hwnd, GWLP_EXSTYLE, newExStyle)
     640        _System_SetWindowLongPtr(hwnd, GWL_EXSTYLE, newExStyle)
    643641    End Sub
    644642
     
    648646
    649647    Sub Style(newStyle As DWord)
    650         _System_SetWindowLongPtr(hwnd, GWLP_STYLE, newStyle)
     648        _System_SetWindowLongPtr(hwnd, GWL_STYLE, newStyle)
    651649    End Sub
    652650
     
    660658
    661659    Const Function Font() As HFONT
    662         Return SendMessage(hwnd, WM_GETFONT, 0, 0) As HFONT
     660        Return _System_SendMessage(hwnd, WM_GETFONT, 0, 0) As HFONT
    663661    End Function
    664662
    665663    Sub Font(hfntNew As HFONT)
    666         SendMessage(hwnd, WM_SETFONT, hfntNew As WPARAM, TRUE)
     664        _System_SendMessage(hwnd, WM_SETFONT, hfntNew As WPARAM, TRUE)
    667665    End Sub
    668666
     
    680678
    681679    Const Function Minimized() As Boolean
    682         Return IsIconic(hwnd) As Boolean
     680        Return _System_IsIconic(hwnd) As Boolean
    683681    End Function
    684682
     
    705703    End Sub
    706704
    707     Const Function ProcessID() As DWord
    708         GetWindowProcessThreadId(ProcessID)
    709     End Function
    710 
    711     Const Function ThreadID() As DWord
    712         Return GetWindowProcessThreadId(ByVal 0)
     705    Const Function ProcessId() As DWord
     706        GetWindowThreadProcessId(ProcessId)
     707    End Function
     708
     709    Const Function ThreadId() As DWord
     710        Return GetWindowThreadProcessId(ByVal 0)
    713711    End Function
    714712
     
    759757        Return GetWindowTextLength(hwnd)
    760758    End Function
    761 
     759#ifdef _UNDEF
    762760    Const Function UserData() As LONG_PTR
    763761        Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)
     
    767765        _System_SetWindowLongPtr(hwnd, GWLP_USERDATA, newValue)
    768766    End Sub
    769 
     767#endif
    770768    Const Function Visible() As Boolean
    771         Return IsVisible(hwnd) As Boolean
     769        Return IsWindowVisible(hwnd) As Boolean
    772770    End Function
    773771
     
    779777        EndIf
    780778    End Sub
    781 
     779#ifdef _UNDEF
    782780    Const Function WindowPlacement() As WINDOWPLACEMENT
    783781        WindowPlacement.length = Len(WindowPlacement)
     
    796794        _System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, newWndProc As LONG_PTR)
    797795    End Sub
    798 
     796#endif
    799797Protected
    800798    Sub SetHWnd(hwndNew As HWND)
     
    803801End Class
    804802
    805 #endif '__WINDOWS_WINDOWHANDLE_SBP__
     803End Namespace 'Widnows
     804End Namespace 'ActiveBasic
Note: See TracChangeset for help on using the changeset viewer.