Ignore:
Timestamp:
Mar 28, 2007, 10:29:58 AM (17 years ago)
Author:
イグトランス (egtra)
Message:

Currencyを追加、その他修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/windows/WindowHandle.sbp

    r178 r192  
    1 #ifndef __WINDOWSHANDLE_SBP__
    2 #define __WINDOWSHANDLE_SBP__
     1#ifndef __WINDOWS_WINDOWHANDLE_SBP__
     2#define __WINDOWS_WINDOWHANDLE_SBP__
    33
    44#ifdef _WIN64
    5 Declare Function _System_GetWindowLongPtr Lib "user32" Alias "GetWindowLongPtrA" (hWnd As HWND, nIndex As Long) As LONG_PTR
    6 Declare Function _System_SetWindowLongPtr Lib "user32" Alias "SetWindowLongPtrA" (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
     5Declare Function _System_GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLongPtr (hWnd As HWND, nIndex As Long) As LONG_PTR
     6Declare Function _System_SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLongPtr (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
    77#else
    8 Declare Function _System_GetWindowLongPtr Lib "user32" Alias "GetWindowLongA" (hWnd As HWND, nIndex As Long) As LONG_PTR
    9 Declare Function _System_SetWindowLongPtr Lib "user32" Alias "SetWindowLongA" (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
     8Declare Function _System_GetWindowLongPtr Lib "user32" Alias _FuncName_GetWindowLong (hWnd As HWND, nIndex As Long) As LONG_PTR
     9Declare Function _System_SetWindowLongPtr Lib "user32" Alias _FuncName_SetWindowLong (hWnd As HWND, nIndex As Long, l As LONG_PTR) As LONG_PTR
    1010#endif
    1111Declare Function _System_GetParent Lib "user32" Alias "GetParent" (hWnd As HWND) As HWND
     
    1818Declare Function _System_ValidateRgn Lib "user32" Alias "ValidateRgn" (hWnd As HWND, hRgn As HRGN) As BOOL
    1919Declare Function _System_BeginPaint Lib "user32" Alias "BeginPaint" (hWnd As HWND, ByRef ps As PAINTSTRUCT) As HDC
    20 Declare Function _System_EndPaint Lib "user32" Alias "EndPaint" (hWnd As HWND, ByRef lpPaint As PAINTSTRUCT) As HDC
    21 Declare Function _System_ClientToScreen Lib "user32" Alias "ClientToScreen" (hWnd As HWND, ByRef lpPoint As POINTAPI) As BOOL
    22 Declare Function _System_ScreenToClient Lib "user32" Alias "ScreenToClient" (hWnd As HWND, ByRef lpPoint As POINTAPI) As BOOL
     20Declare Function _System_EndPaint Lib "user32" Alias "EndPaint" (hWnd As HWND, ByRef ps As PAINTSTRUCT) As HDC
     21Declare Function _System_ClientToScreen Lib "user32" Alias "ClientToScreen" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
     22Declare Function _System_ScreenToClient Lib "user32" Alias "ScreenToClient" (hWnd As HWND, ByRef Point As POINTAPI) As BOOL
    2323Declare Function _System_CreateCaret Lib "user32" Alias "CreateCaret" (hWnd As HWND, hBitmap As HBITMAP, nWidth As Long, nHeight As Long) As BOOL
    2424Declare Function _System_HideCaret Lib "user32" Alias "HideCaret" (hWnd As HWND) As BOOL
     
    2828Declare Function _System_IsWindow Lib "user32" Alias "IsWindow" (hWnd As HWND) As BOOL
    2929Declare Function _System_Isiconic Lib "user32" Alias "Isiconic" (hWnd As HWND) As BOOL
    30 Declare Function _System_GetClientRect Lib "user32" Alias "GetClientRect" (hWnd As HWND, ByRef lpRect As RECT) As BOOL
     30Declare Function _System_GetClientRect Lib "user32" Alias "GetClientRect" (hWnd As HWND, ByRef Rect As RECT) As BOOL
    3131
    3232Class WindowHandle
     
    4141    End Sub
    4242
    43     Sub WindowHandle(ByRef wnd As WindowHandle)
     43    Sub WindowHandle(wnd As WindowHandle)
    4444        hwnd = wnd.hwnd
    4545    End Sub
     
    117117    End Function
    118118
    119     Const Function GetClassName(className As PSTR, maxCount As Long) As Long
     119    Const Function GetClassName(className As PTSTR, maxCount As Long) As Long
    120120        Return GetClassName(className, maxCount)
    121121    End Function
     
    145145    End Function
    146146
    147     Const Function GetDlgItemText(idDlgItem As Long, ps As PSTR, maxCount As Long) As Long
     147    Const Function GetDlgItemText(idDlgItem As Long, ps As PTSTR, maxCount As Long) As Long
    148148        Return GetDlgItemText(hwnd, idDlgItem, ps, maxCount)
    149149    End Function
     
    158158    End Function
    159159
    160     Const Function GetProp(psz As PCSTR) As HANDLE
     160    Const Function GetProp(str As String) As HANDLE
     161        Return GetProp(hwnd, ToTCStr(str))
     162    End Function
     163
     164    Const Function GetProp(psz As PCTSTR) As HANDLE
    161165        Return GetProp(hwnd, psz)
    162166    End Function
    163167
    164168    Const Function GetProp(atom As ATOM) As HANDLE
    165         Return GetProp(hwnd, atom As ULONG_PTR As PCSTR)
     169        Return GetProp(hwnd, atom As ULONG_PTR As PCTSTR)
    166170    End Function
    167171
     
    202206    End Function
    203207
    204     Const Function GetText(ps As PSTR, maxCount As Long) As Boolean
     208    Const Function GetText(ps As PTSTR, maxCount As Long) As Boolean
    205209        Return GetWindowText(ps, maxCount) As Boolean
    206210    End Function
     
    215219
    216220    Const Function GetWindowProcessThreadId(ByRef processId As DWord) As DWord
    217         Return GetWindowProcessThreadId(hwnd, processId)
     221        Return GetWindowProcessThreadId(hwnd, VarPtr(processId))
    218222    End Function
    219223
     
    294298    End Function
    295299
    296     Const Function MessageBox(text As PCSTR, caption As PCSTR, uType As DWord) As Long
     300    Const Function MessageBox(text As PCTSTR, caption As PCTSTR, uType As DWord) As Long
    297301        Return MessageBox(hwnd, text, caption, uType)
    298302    End Function
    299303
    300     Const Function MessageBox(text As PCSTR, caption As PCSTR) As Long
     304    Const Function MessageBox(text As PCTSTR, caption As PCTSTR) As Long
    301305        Return MessageBox(hwnd, text, caption, MB_OK)
    302306    End Function
    303307
    304     Const Function MessageBox(text As PCSTR) As Long
     308    Const Function MessageBox(text As PCTSTR) As Long
    305309        Return MessageBox(hwnd, text, 0, MB_OK)
    306310    End Function
     
    350354    End Function
    351355
    352     Function RemoveProp(psz As PCSTR) As HANDLE
     356    Function RemoveProp(str As String) As HANDLE
     357        Return RemoveProp(hwnd, ToTCStr(str))
     358    End Function
     359
     360    Function RemoveProp(psz As PCTSTR) As HANDLE
    353361        Return RemoveProp(hwnd, psz)
    354362    End Function
    355363
    356364    Function RemoveProp(atom As ATOM) As HANDLE
    357         Return RemoveProp(hwnd, atom As ULONG_PTR As PCSTR)
     365        Return RemoveProp(hwnd, atom As ULONG_PTR As PCTSTR)
    358366    End Function
    359367
     
    386394    End Function
    387395
    388     Function SetDlgItemText(idDlgItem As Long, psz As PCSTR) As Boolean
     396    Function SetDlgItemText(idDlgItem As Long, psz As PCTSTR) As Boolean
    389397        Return SetDlgItemText(hwnd, idDlgItem, psz) As Boolean
    390398    End Function
     
    414422    End Function
    415423
    416     Function SetProp(psz As PCSTR, hData As HANDLE) As Boolean
     424    Function SetProp(str As String, hData As HANDLE) As Boolean
     425        Return SetProp(hwnd, ToTCStr(str), hData) As Boolean
     426    End Function
     427
     428    Function SetProp(psz As PCTSTR, hData As HANDLE) As Boolean
    417429        Return SetProp(hwnd, psz, hData) As Boolean
    418430    End Function
    419431
    420432    Function SetProp(atom As ATOM, hData As HANDLE) As Boolean
    421         Return SetProp(atom As ULONG_PTR As PCSTR, hData) As Boolean
     433        Return SetProp(atom As ULONG_PTR As PCTSTR, hData) As Boolean
    422434    End Function
    423435
     
    468480    End Function
    469481
    470     Function SetText(psz As PCSTR) As Boolean
     482    Function SetText(psz As PCTSTR) As Boolean
    471483        Return SetWindowText(hwnd, psz) As Boolean
     484    End Function
     485
     486    Function SetText(str As String) As Boolean
     487        Return SetWindowText(hwnd, ToTCStr(str)) As Boolean
    472488    End Function
    473489
     
    682698    End Sub
    683699
     700    Const Function Prop(str As String) As HANDLE
     701        Return GetProp(str)
     702    End Function
     703
     704    Const Function Prop(psz As PCTSTR) As HANDLE
     705        Return GetProp(psz)
     706    End Function
     707
     708    Const Function Prop(atom As ATOM) As HANDLE
     709        Return GetProp(atom)
     710    End Function
     711
     712    Sub Prop(str As PCTSTR, h As HANDLE)
     713        SetProp(str, h)
     714    End Sub
     715
     716    Sub Prop(psz As PCTSTR, h As HANDLE)
     717        SetProp(psz, h)
     718    End Sub
     719
     720    Sub Prop(atom As ATOM, h As HANDLE)
     721        SetProp(atom, h)
     722    End Sub
     723
    684724    Const Function Text() As String
    685         With Text
    686             .ReSize(GetWindowTextLength(hwnd))
    687             .ReSize(GetWindowText(hwnd, .Chars, .Length + 1))
    688         End With
    689     End Function
    690 
    691     Sub Text(newText As PCSTR)
     725        Dim size = GetWindowTextLength(hwnd) + 1
     726        Dim p = _System_malloc(SizeOf (TCHAR) * size) As PTSTR
     727        Dim length = GetWindowText(hwnd, p, size)
     728        Return New String(p, length As SIZE_T)
     729    End Function
     730
     731    Sub Text(newText As String)
     732        SetWindowText(hwnd, ToTCStr(newText))
     733    End Sub
     734
     735    Sub Text(newText As PCTSTR)
    692736        SetWindowText(hwnd, newText)
    693737    End Sub
     
    740784End Class
    741785
    742 #endif '__WINDOWSHANDLE_SBP__
     786#endif '__WINDOWS_WINDOWHANDLE_SBP__
Note: See TracChangeset for help on using the changeset viewer.