コード: 全て選択
/*
CWindowBaseEx
Public
'----------Window Initialize Method----------
Sub CWindowBaseEx(ByVal hWnd As HWND)
'----------Window Text Method----------
Function getTextLength() As Long
'----------Window Font Method----------
Sub setFont(ByVal hFont As HFONT,ByVal bRedraw As Long)
Function getFont() As HFONT
'----------Window Size Method----------
Sub setSize(ByVal width As Long,ByVal height As Long)
Sub getSize(ByRef lpSize As SIZE)
Sub setWidth(ByVal width As Long)
Function getWidth() As Long
Sub setHeight(ByVal height As Long)
Function getHeight() As Long
'----------Window Rectangle Method----------
Sub getRect(ByRef lpRect As RECT)
Sub getClientRect(ByRef lpRect As RECT)
'----------Window Position Method----------
Sub setPos(ByVal x As Long,ByVal y As Long)
Sub getPos(ByRef lpPoint As POINTAPI)
Sub setX(ByVal x As Long)
Function getX() As Long
Sub setY(ByVal y As Long)
Function getY() As Long
'----------Window Size And Position Method----------
Sub move(ByVal x As Long,ByVal y As Long,ByVal nWidth As Long,ByVal nHeight As Long,ByVal bRepain As Long)
'----------Window State Method----------
Sub enable(ByVal bEnable As Long)
Function isEnabled() As Long
Function setParent(ByVal hWndNewParent As HWND) As HWND
Function getParent() As HWND
Function setLong(ByVal nIndex As Long,ByVal NewLong As Long) As Long
Function getLong(ByVal nIndex As Long) As Long
Function setClassLong(ByVal nIndex As Long,ByVal NewLong As Long) As DWord
Function getClassLong(ByVal nIndex As Long) As DWord
Sub setFocus()
Function getFocus() As HWND
Function setCapture() As HWND
Function getCapture() As HWND
Sub releaseCapture()
'----------Window Message Method----------
Function sendMessage(ByVal wMsg As DWord,ByVal wParam As DWord,ByVal lParam As DWord) As Long
Function postMessage(ByVal wMsg As DWord,ByVal wParam As DWord,ByVal lParam As DWord) As Long
'----------Window Style Method----------
Function setStyle(ByVal newLong As Long) As Long
Function getStyle() As Long
Function setExStyle(ByVal newLong As Long) As Long
Function getExStyle() As Long
'----------Window Update And Draw Method----------
Sub show(ByVal bShow As Long)
Function isShowing() As Long
Function getDC() As HDC
Sub releaseDC(ByVal hDC As HDC)
Sub setRedraw(ByVal bRedraw As Long)
Sub invalidate(ByVal bErase As Long)
Sub invalidateRect(ByRef lpRect As RECT,ByVal bErase As Long)
Sub update()
Sub lockUpdate(ByVal bLock As Long)
'----------Window Locate Method----------
Sub toScreen(ByRef lpPoint As POINTAPI)
Sub toClient(ByRef lpPoint As POINTAPI)
'----------Window Alarm Method----------
Function messageBox(ByVal lpText As BytePtr,ByVal lpCaption As BytePtr,ByVal uType As DWord) As Long
Sub messageBeep(ByVal uType As DWord)
*/
Class CWindowBaseEx
Inherits CWindowBase
Public
'----------Window Initialize Method----------
Sub CWindowBaseEx(ByVal hWnd As HWND)
CWindowBase(hWnd)
End Sub
'----------Window Text Method----------
Function getTextLength() As Long
getTextLength=GetWindowTextLength(c_hWnd)
End Function
'----------Window Font Method----------
Sub setFont(ByVal hFont As HFONT,ByVal bRedraw As Long)
sendMessage(WM_SETFONT,hFont As DWord,bRedraw As DWord)
End Sub
Function getFont() As HFONT
getFont=sendMessage(WM_GETFONT,NULL,NULL) As HFONT
End Function
'----------Window Size Method----------
Sub setSize(ByVal width As Long,ByVal height As Long)
SetWindowPos(c_hWnd,NULL,NULL,NULL,width,height,SWP_NOMOVE)
End Sub
Sub getSize(ByRef lpSize As SIZE)
Dim tmpRect As RECT
GetWindowRect(c_hWnd,tmpRect)
lpSize.cx=tmpRect.right-tmpRect.left
lpSize.cy=tmpRect.bottom-tmpRect.top
End Sub
Sub setWidth(ByVal width As Long)
setSize(width,getHeight())
End Sub
Function getWidth() As Long
Dim tmpSize As SIZE
getSize(tmpSize)
getWidth=tmpSize.cx
End Function
Sub setHeight(ByVal height As Long)
setSize(getWidth(),height)
End Sub
Function getHeight() As Long
Dim tmpSize As SIZE
getSize(tmpSize)
getHeight=tmpSize.cy
End Function
'----------Window Rectangle Method----------
Sub getRect(ByRef lpRect As RECT)
GetWindowRect(c_hWnd,lpRect)
End Sub
Sub getClientRect(ByRef lpRect As RECT)
GetClientRect(c_hWnd,lpRect)
End Sub
'----------Window Position Method----------
Sub setPos(ByVal x As Long,ByVal y As Long)
SetWindowPos(c_hWnd,NULL,x,y,NULL,NULL,SWP_NOSIZE)
End Sub
Sub getPos(ByRef lpPoint As POINTAPI)
Dim tmpRect As RECT
GetWindowRect(c_hWnd,tmpRect)
lpPoint.x=tmpRect.left
lpPoint.y=tmpRect.top
End Sub
Sub setX(ByVal x As Long)
setPos(x,getY())
End Sub
Function getX() As Long
Dim tmpPoint As POINTAPI
getPos(tmpPoint)
getX=tmpPoint.x
End Function
Sub setY(ByVal y As Long)
setPos(getX(),y)
End Sub
Function getY() As Long
Dim tmpPoint As POINTAPI
getPos(tmpPoint)
getY=tmpPoint.y
End Function
'----------Window Size And Position Method----------
Sub move(ByVal x As Long,ByVal y As Long,ByVal nWidth As Long,ByVal nHeight As Long,ByVal bRepain As Long)
MoveWindow(c_hWnd,x,y,nWidth,nHeight,bRepain)
End Sub
'----------Window State Method----------
Sub enable(ByVal bEnable As Long)
EnableWindow(This.c_hWnd,bEnable)
End Sub
Function isEnabled() As Long
isEnabled=IsWindowEnabled(c_hWnd)
End Function
Function setParent(ByVal hWndNewParent As HWND) As HWND
setParent=SetParent(c_hWnd,hWndNewParent)
End Function
Function getParent() As HWND
getParent=GetParent(c_hWnd)
End Function
Function setLong(ByVal nIndex As Long,ByVal NewLong As Long) As Long
setLong=SetWindowLong(c_hWnd,nIndex,NewLong)
End Function
Function getLong(ByVal nIndex As Long) As Long
getLong=GetWindowLong(c_hWnd,nIndex)
End Function
Function setClassLong(ByVal nIndex As Long,ByVal NewLong As Long) As DWord
setClassLong=SetClassLong(c_hWnd,nIndex,NewLong)
End Function
Function getClassLong(ByVal nIndex As Long) As DWord
getClassLong=GetClassLong(c_hWnd,nIndex)
End Function
Sub setFocus()
SetFocus(c_hWnd)
End Sub
Function getFocus() As HWND
getFocus=GetFocus()
End Function
Function setCapture() As HWND
setCapture=SetCapture(c_hWnd)
End Function
Function getCapture() As HWND
getCapture=GetCapture()
End Function
Sub releaseCapture()
ReleaseCapture()
End Sub
'----------Window Message Method----------
Function sendMessage(ByVal wMsg As DWord,ByVal wParam As DWord,ByVal lParam As DWord) As Long
sendMessage=SendMessage(c_hWnd,wMsg,wParam,lParam)
End Function
Function postMessage(ByVal wMsg As DWord,ByVal wParam As DWord,ByVal lParam As DWord) As Long
postMessage=PostMessage(c_hWnd,wMsg,wParam,lParam)
End Function
'----------Window Style Method----------
Function setStyle(ByVal newLong As Long) As Long
setStyle=SetWindowLong(c_hWnd,GWL_STYLE,newLong)
End Function
Function getStyle() As Long
getStyle=GetWindowLong(c_hWnd,GWL_STYLE)
End Function
Function setExStyle(ByVal newLong As Long) As Long
setExStyle=SetWindowLong(c_hWnd,GWL_EXSTYLE,newLong)
End Function
Function getExStyle() As Long
getExStyle=GetWindowLong(c_hWnd,GWL_EXSTYLE)
End Function
'----------Window Update And Draw Method----------
Sub show(ByVal bShow As Long)
If bShow Then
ShowWindow(c_hWnd,SW_SHOW)
Else
ShowWindow(c_hWnd,SW_HIDE)
End If
End Sub
Function isShowing() As Long
isShowing=IsWindowVisible(c_hWnd)
End Function
Function getDC() As HDC
getDC=GetDC(c_hWnd)
End Function
Sub releaseDC(ByVal hDC As HDC)
ReleaseDC(c_hWnd,hDC)
End Sub
Sub setRedraw(ByVal bRedraw As Long)
sendMessage(WM_SETREDRAW,bRedraw As DWord,NULL)
End Sub
Sub invalidate(ByVal bErase As Long)
invalidateRect(ByVal NULL,bErase)
End Sub
Sub invalidateRect(ByRef lpRect As RECT,ByVal bErase As Long)
InvalidateRect(c_hWnd,lpRect,bErase)
End Sub
Sub update()
UpdateWindow(c_hWnd)
End Sub
Sub lockUpdate(ByVal bLock As Long)
If bLock Then
LockWindowUpdate(c_hWnd)
Else
LockWindowUpdate(NULL)
End If
End Sub
'----------Window Locate Method----------
Sub toScreen(ByRef lpPoint As POINTAPI)
ClientToScreen(c_hWnd,lpPoint)
End Sub
Sub toClient(ByRef lpPoint As POINTAPI)
ScreenToClient(c_hWnd,lpPoint)
End Sub
'----------Window Alarm Method----------
Function messageBox(ByVal lpText As BytePtr,ByVal lpCaption As BytePtr,ByVal uType As DWord) As Long
messageBox=MessageBox(c_hWnd,lpText,lpCaption,uType)
End Function
Sub messageBeep(ByVal uType As DWord)
MessageBeep(uType)
End Sub
End Class