Index: trunk/Include/Classes/ActiveBasic/Windows/WindowHandle.sbp
===================================================================
--- trunk/Include/Classes/ActiveBasic/Windows/WindowHandle.sbp	(revision 302)
+++ trunk/Include/Classes/ActiveBasic/Windows/WindowHandle.sbp	(revision 303)
@@ -1,6 +1,3 @@
-' Windows/WindowHandle.sbp
-
-#ifndef __WINDOWS_WINDOWHANDLE_SBP__
-#define __WINDOWS_WINDOWHANDLE_SBP__
+'Classes/ActiveBasic/Windows/WindowHandle.sbp
 
 #ifdef _WIN64
@@ -16,7 +13,7 @@
 #endif
 Declare Function _System_GetParent Lib "user32" Alias "GetParent" (hWnd As HWND) As HWND
-Declare Function _System_SetParent Lib "user32" Alias "SetParent" (hWnd As HWND) As HWND
+Declare Function _System_SetParent Lib "user32" Alias "SetParent" (hWnd As HWND, hwndParent As HWND) As HWND
 Declare Function _System_GetMenu Lib "user32" Alias "GetMenu" (hWnd As HWND) As HMENU
-Declare Function _System_SetMenu Lib "user32" Alias "SetMenu" (hWnd As HWND) As HMENU
+Declare Function _System_SetMenu Lib "user32" Alias "SetMenu" (hWnd As HWND, hmenu As HMENU) As HMENU
 Declare Function _System_InvalidateRect Lib "user32" Alias "InvalidateRect" (hWnd As HWND, ByRef Rect As RECT, bErase As BOOL) As BOOL
 Declare Function _System_InvalidateRgn Lib "user32" Alias "InvalidateRgn" (hWnd As HWND, hRgn As HRGN, bErase As BOOL) As BOOL
@@ -33,5 +30,5 @@
 Declare Function _System_GetWindowRect Lib "user32" Alias "DrawMenuBar" (hWnd As HWND, ByRef Rect As RECT) As BOOL
 Declare Function _System_IsWindow Lib "user32" Alias "IsWindow" (hWnd As HWND) As BOOL
-Declare Function _System_Isiconic Lib "user32" Alias "Isiconic" (hWnd As HWND) As BOOL
+Declare Function _System_IsIconic Lib "user32" Alias "IsIconic" (hWnd As HWND) As BOOL
 Declare Function _System_GetClientRect Lib "user32" Alias "GetClientRect" (hWnd As HWND, ByRef Rect As RECT) As BOOL
 Declare Function _System_GetProp Lib "user32" Alias _FuncName_GetProp (hWnd As HWND, pString As PCTSTR) As HANDLE
@@ -41,6 +38,15 @@
 Declare Function _System_SetScrollInfo Lib "user32" Alias "SetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO, bRedraw As Long) As BOOL
 Declare Function _System_GetSystemMenu Lib "user32" Alias "GetSystemMenu" (hWnd As HWND, bRevert As BOOL) As HMENU
-Declare Function _System_GetDC Lib "gdi32" Alias "GetDC" (hwnd As HWND) As HDC
-Declare Function _System_ReleaseDC Lib "gdi32" Alias "ReleaseDC" (hwnd As HWND, hdc As HDC) As BOOL
+Declare Function _System_GetDC Lib "user32" Alias "GetDC" (hwnd As HWND) As HDC
+Declare Function _System_GetDCEx Lib "user32" Alias "GetDCEx" (hwnd As HWND, hrgnClip As HRGN, flags As DWord) As HDC
+Declare Function _System_GetWindowDC Lib "user32" Alias "GetWindowDC" (hwnd As HWND) As HDC
+Declare Function _System_ReleaseDC Lib "user32" Alias "ReleaseDC" (hwnd As HWND, hdc As HDC) As BOOL
+Declare Function _System_SendMessage Lib "user32" Alias _FuncName_SendMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+Declare Function _System_PostMessage Lib "user32" Alias _FuncName_PostMessage (hwnd As HWND, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
+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
+Declare Function _System_GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (hwnd As HWND, pdwProcessId As *DWord) As DWord
+
+Namespace ActiveBasic
+Namespace Windows
 
 Class WindowHandle
@@ -55,12 +61,4 @@
 	End Sub
 
-	Sub WindowHandle(wnd As WindowHandle)
-		hwnd = wnd.hwnd
-	End Sub
-
-	Sub Operator =(hwndNew As HWND)
-		hwnd = hwndNew
-	End Sub
-
 	Const Function HWnd() As HWND
 		Return hwnd
@@ -78,5 +76,5 @@
 		Return _System_BeginPaint(hwnd, ps)
 	End Function
-
+/*
 	Const Function ChildFromPoint(x As Long, y As Long) As WindowHandle
 		Return New WindowHandle(ChildWindowFromPoint(hwnd, x, y))
@@ -86,5 +84,5 @@
 		Return New WindowHandle(ChildWindowFromPointEx(hwnd, x, y, flags))
 	End Function
-
+*/
 	Const Function ClientToScreen(ByRef pt As POINTAPI) As Boolean
 		Return _System_ClientToScreen(hwnd, pt) As Boolean
@@ -101,5 +99,5 @@
 
 	Function CreateCaret(hbmp As HBITMAP, width As Long, height As Long) As Boolean
-		Return _System_CreateCaret(hwnd, hbmp, width, hegiht) As Boolean
+		Return _System_CreateCaret(hwnd, hbmp, width, height) As Boolean
 	End Function
 
@@ -111,9 +109,9 @@
 		Return _System_DrawMenuBar(hwnd) As Boolean
 	End Function
-
+/*
 	Function EnableScrollBar(SBFlags As DWord, arrows As DWord) As Boolean
 		Return EnableScrollBar(hwnd, SBFlags, arrows) As Boolean
 	End Function
-
+*/
 	Function Enable(enable As Boolean) As Boolean
 		Return EnableWindow(hwnd, enable) As Boolean
@@ -137,5 +135,5 @@
 
 	Const Function GetClassName(className As PTSTR, maxCount As Long) As Long
-		Return _System_GetClassName(className, maxCount)
+		Return _System_GetClassName(hwnd, className, maxCount)
 	End Function
 
@@ -143,9 +141,9 @@
 		Return _System_GetClientRect(hwnd, rc) As Boolean
 	End Function
-
+/*
 	Const Function GetContextHelpId() As DWord
 		Return GetWindowContextHelpId(hwnd)
 	End Function
-
+*/
 	Function GetDC() As HDC
 		Return _System_GetDC(hwnd)
@@ -153,7 +151,7 @@
 
 	Function GetDCEx(hrgnClip As HRGN, flags As DWord) As HDC
-		Return GetDCEx(hwnd, hrgnClip, flags)
-	End Function
-
+		Return _System_GetDCEx(hwnd, hrgnClip, flags)
+	End Function
+/*
 	Const Function GetDlgCtrlID() As Long
 		Return GetDlgCtrlID(hwnd)
@@ -167,13 +165,13 @@
 		Return GetDlgItemText(hwnd, idDlgItem, ps, maxCount)
 	End Function
-
+*/
 	Const Function GetMenu() As HMENU
 		Return _System_GetMenu(hwnd)
 	End Function
-
+/*
 	Const Function GetParent() As WindowHandle
 		Return New WindowHandle(_System_GetParent(hwnd))
 	End Function
-
+*/
 	Const Function GetProp(str As String) As HANDLE
 		Return _System_GetProp(hwnd, ToTCStr(str))
@@ -191,5 +189,5 @@
 		Return _System_GetScrollInfo(hwnd, fnBar, si) As Boolean
 	End Function
-
+/*
 	Const Function GetSystemMenu(revert As Boolean) As HMENU
 		Return GetSystemMenu(hwnd, revert)
@@ -207,7 +205,7 @@
 		Return GetWindow(hwnd, cmd)
 	End Function
-
+*/
 	Function GetWindowDC() As HDC
-		Return GetWindowDC(hwnd)
+		Return _System_GetWindowDC(hwnd)
 	End Function
 
@@ -215,15 +213,15 @@
 		Return _System_GetWindowLongPtr(hwnd, index)
 	End Function
-
+/*
 	Const Function GetWindowPlasement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
 		Return GetWindowPlasement(hwnd, wndpl) As Boolean
 	End Function
-
+*/
 	Const Function GetWindowRect(ByRef rc As RECT) As Boolean
-		Return _System_GetWindowRect(rc) As Boolean
+		Return _System_GetWindowRect(hwnd, rc) As Boolean
 	End Function
 
 	Const Function GetText(ps As PTSTR, maxCount As Long) As Boolean
-		Return GetWindowText(ps, maxCount) As Boolean
+		Return GetWindowText(hwnd, ps, maxCount) As Boolean
 	End Function
 
@@ -233,9 +231,9 @@
 
 	Const Function GetWindowThreadId() As DWord
-		Return GetWindowProcessThreadId(hwnd, 0)
-	End Function
-
-	Const Function GetWindowProcessThreadId(ByRef processId As DWord) As DWord
-		Return GetWindowProcessThreadId(hwnd, VarPtr(processId))
+		Return _System_GetWindowThreadProcessId(hwnd, 0)
+	End Function
+
+	Const Function GetWindowThreadProcessId(ByRef processId As DWord) As DWord
+		Return _System_GetWindowThreadProcessId(hwnd, VarPtr(processId))
 	End Function
 
@@ -267,5 +265,5 @@
 		Return _System_InvalidateRect(hwnd, ByVal 0, TRUE) As Boolean
 	End Function
-
+/*
 	Const Function IsChild(hwnd As HWND) As Boolean
 		Return IsChild(This.hwnd, hwnd) As Boolean
@@ -275,5 +273,5 @@
 		Return IsDialogMessage(hwnd, msg) As Boolean
 	End Function
-
+*/
 	Const Function IsIconic() As Boolean
 		Return _System_IsIconic(hwnd) As Boolean
@@ -295,5 +293,5 @@
 		Return IsWindowVisible(hwnd) As Boolean
 	End Function
-
+/*
 	Const Function IsZoomed() As Boolean
 		Return IsZoomed(hwnd) As Boolean
@@ -303,9 +301,9 @@
 		Return KillTimer(idEvent) As Boolean
 	End Function
-
+*/
 	Function LockUpdate() As Boolean
 		Return LockWindowUpdate(hwnd) As Boolean
 	End Function
-
+/*
 	Function MapPoints(hwndTo As HWND, pPoints As *POINTAPI, cPoints As DWord) As Long
 		Return MapWindowPoints(hwnd, hwndTo, pPoints, cPoints)
@@ -327,5 +325,5 @@
 		Return MessageBox(hwnd, text, 0, MB_OK)
 	End Function
-
+*/
 	Function Move(x As Long, y As Long, width As Long, height As Long, repaint As Boolean) As Boolean
 		Return MoveWindow(hwnd, x, y, width, height, repaint) As Boolean
@@ -336,5 +334,5 @@
 	End Function
 
-	Function Move(ByRef rc As RECT, repeaint As Boolean) As Boolean
+	Function Move(ByRef rc As RECT, repaint As Boolean) As Boolean
 		With rc
 			Return MoveWindow(hwnd, .left, .top, .right - .left, .bottom - .top, repaint) As Boolean
@@ -347,5 +345,5 @@
 		End With
 	End Function
-
+/*
 	Function OpenClipboard() As Boolean
 		Return OpenClipboard(hwnd) As Boolean
@@ -355,21 +353,21 @@
 		Return OpenIcon(hwnd) As Boolean
 	End Function
-
+*/
 	Function PostMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As Boolean
-		Return PostMessage(hwnd, msg, wp, lp) As Boolean
+		Return _System_PostMessage(hwnd, msg, wp, lp) As Boolean
 	End Function
 
 	Function PostMessage(msg As DWord) As Boolean
-		Return PostMessage(hwnd, msg, 0, 0) As Boolean
-	End Function
-
+		Return _System_PostMessage(hwnd, msg, 0, 0) As Boolean
+	End Function
+/*
 	Function RedrawWindow(ByRef rcUpdate As RECT, hrgnUpdate As HRGN, flags As DWord) As Boolean
 		Return RedrawWindow(hwnd, rcUpdatre, hrgnUpdate, flags) As Boolean
 	End Function
-
+*/
 	Function ReleaseDC(hdc As HDC) As Boolean
 		Return _System_ReleaseDC(hwnd, hdc) As Boolean
 	End Function
-
+/*
 	Function RemoveProp(str As String) As HANDLE
 		Return RemoveProp(hwnd, ToTCStr(str))
@@ -383,5 +381,5 @@
 		Return RemoveProp(hwnd, atom As ULONG_PTR As PCTSTR)
 	End Function
-
+*/
 	Const Function ScreenToClient(ByRef pt As POINTAPI) As Boolean
 		Return _System_ScreenToClient(hwnd, pt) As Boolean
@@ -398,19 +396,19 @@
 
 	Function SendDlgItemMessage(idDlgItem As Long, msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
-		Return SendDlgItemMessage(hwnd, idDlgItem, wp, lp)
+		Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, wp, lp)
 	End Function
 
 	Function SendDlgItemMessage(idDlgItem As Long, msg As DWord) As LRESULT
-		Return SendDlgItemMessage(hwnd, idDlgItem, 0, 0)
+		Return _System_SendDlgItemMessage(hwnd, idDlgItem, msg, 0, 0)
 	End Function
 
 	Function SendMessage(msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
-		Return SendMessage(hwnd, msg, wp, lp)
+		Return _System_SendMessage(hwnd, msg, wp, lp)
 	End Function
 
 	Function SendMessage(msg As DWord) As LRESULT
-		Return SendMessage(hwnd, msg, 0, 0)
-	End Function
-
+		Return _System_SendMessage(hwnd, msg, 0, 0)
+	End Function
+/*
 	Function SetActiveWindow() As WindowHandle
 		Return New WindowHandle(SetActiveWindow(hwnd))
@@ -424,13 +422,13 @@
 		Return New WindowHandle(SetCapture(hwnd))
 	End Function
-
+*/
 	Function SetClassLongPtr(index As Long, newLong As LONG_PTR) As LONG_PTR
 		Return _System_SetClassLongPtr(hwnd, index, newLong)
 	End Function
-
+/*
 	Function SetFocus() As WindowHandle
 		Return New WindowHandle(SetFocus(hwnd))
 	End Function
-
+*/
 	Function SetForeground() As Boolean
 		Return SetForegroundWindow(hwnd) As Boolean
@@ -454,5 +452,5 @@
 
 	Function SetProp(atom As ATOM, hData As HANDLE) As Boolean
-		Return SetProp((atom As ULONG_PTR) As PCTSTR, hData) As Boolean
+		Return This.SetProp((atom As ULONG_PTR) As PCTSTR, hData) As Boolean
 	End Function
 
@@ -464,5 +462,5 @@
 		Return _System_SetScrollInfo(hwnd, fnBar, si, TRUE) As Boolean
 	End Function
-
+/*
 	Function SetTimer(idEvent As ULONG_PTR, elapse As DWord, timerFunc As TIMERPROC) As ULONG_PTR
 		Return SetTmer(hwnd, idEvent, elapse, timerFunc)
@@ -470,5 +468,5 @@
 
 	Function SetTimer(idEvent As ULONG_PTR, elapse As DWord) As ULONG_PTR
-		Return SetTmer(hwnd, idEvent, elapse, 0)
+		Return This.SetTmer(hwnd, idEvent, elapse, 0)
 	End Function
 
@@ -476,13 +474,13 @@
 		Return SetContextHelpId(hwnd, contextHelpId) As Boolean
 	End Function
-
+*/
 	Function SetWindowLongPtr(index As Long, newLong As LONG_PTR) As LONG_PTR
 		Return _System_SetWindowLongPtr(hwnd, index, newLong)
 	End Function
-
+/*
 	Function SetWindowPlacement(ByRef wndpl As WINDOWPLACEMENT) As Boolean
 		Return SetWindowPlacement(hwnd, wndpl) As Boolean
 	End Function
-
+*/
 	Function SetPos(hwndInsertAfter As HWND, x As Long, y As Long, cx As Long, cy As Long, flags As DWord) As Boolean
 		Return SetWindowPos(hwnd, hwndInsertAfter, x, y, cx, cy, flags) As Boolean
@@ -514,5 +512,5 @@
 		Return _System_ShowCaret(hwnd) As Boolean
 	End Function
-
+/*
 	Function ShowScrollBar(bar As DWord, show As Boolean) As Boolean
 		Return ShowScrollBar(hwnd, bar, show) As Boolean
@@ -522,5 +520,5 @@
 		Return ShowScrollBar(hwnd, bar, TRUE) As Boolean
 	End Function
-
+*/
 	Function Show(cmdShow As DWord) As Boolean
 		Return ShowWindow(hwnd, cmdShow) As Boolean
@@ -556,9 +554,9 @@
 		Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
 	End Function
-
+#ifdef _UNDEF
 	Const Function GetWndProc() As WNDPROC
-		Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As WNDPROC
-	End Function
-
+		Return _System_GetWindowLongPtr(hwnd, GWLP_WNDPROC) As WNDPROC
+	End Function
+#endif
 	Const Function GetInstance() As HINSTANCE
 		Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
@@ -576,11 +574,11 @@
 		Return _System_SetWindowLongPtr(hwnd, GWL_STYLE, style) As DWord
 	End Function
-
+#ifdef _UNDEF
 	Function SetWndProc(wndProc As WNDPROC) As WNDPROC
-		Return _System_SetWindowLongPtR(hwnd, GWLP_WNDPROC, wndProc As WNDPROC) As WNDPROC
-	End Function
-
+		Return _System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, wndProc As WNDPROC) As WNDPROC
+	End Function
+#endif
 	Function SetUserData(value As LONG_PTR) As LONG_PTR
-		Return _System_SetWindowLongPtr(value As LONG_PTR)
+		Return _System_SetWindowLongPtr(hwnd, GWLP_USERDATA, value As LONG_PTR)
 	End Function
 
@@ -592,8 +590,8 @@
 		Return rc
 	End Function
-
+#ifdef _UNDEF
 	Sub ClientRect(ByRef rc As RECT)
 		Dim hasMenu As BOOL
-		If IsChild() = False And IsMenu() <> False Then
+		If IsChild() = False And GetMenu() <> 0 Then
 			hasMenu = TRUE
 		Else
@@ -601,7 +599,7 @@
 		End If
 		AdjustWindowRectEx(rc, GetStyle(), hasMenu, GetExStyle())
-		MoveWindow(rc) ' WindowRect = rc
-	End Sub
-
+		This.Move(rc) ' WindowRect = rc
+	End Sub
+#endif
 	Const Function WindowRect() As RECT
 		Dim rc As RECT
@@ -611,7 +609,7 @@
 
 	Sub WindowRect(ByRef rc As RECT)
-		MoveWindow(rc)
-	End Sub
-
+		This.Move(rc)
+	End Sub
+#ifdef _UNDEF
 	Const Function ContextHelpID() As DWord
 		Return GetContextHelpId(hwnd)
@@ -634,5 +632,5 @@
 		Return w
 	End Function
-
+#endif
 	Const Function ExStyle() As DWord
 		Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
@@ -640,5 +638,5 @@
 
 	Sub ExStyle(newExStyle As DWord)
-		_System_SetWindowLongPtr(hwnd, GWLP_EXSTYLE, newExStyle)
+		_System_SetWindowLongPtr(hwnd, GWL_EXSTYLE, newExStyle)
 	End Sub
 
@@ -648,5 +646,5 @@
 
 	Sub Style(newStyle As DWord)
-		_System_SetWindowLongPtr(hwnd, GWLP_STYLE, newStyle)
+		_System_SetWindowLongPtr(hwnd, GWL_STYLE, newStyle)
 	End Sub
 
@@ -660,9 +658,9 @@
 
 	Const Function Font() As HFONT
-		Return SendMessage(hwnd, WM_GETFONT, 0, 0) As HFONT
+		Return _System_SendMessage(hwnd, WM_GETFONT, 0, 0) As HFONT
 	End Function
 
 	Sub Font(hfntNew As HFONT)
-		SendMessage(hwnd, WM_SETFONT, hfntNew As WPARAM, TRUE)
+		_System_SendMessage(hwnd, WM_SETFONT, hfntNew As WPARAM, TRUE)
 	End Sub
 
@@ -680,5 +678,5 @@
 
 	Const Function Minimized() As Boolean
-		Return IsIconic(hwnd) As Boolean
+		Return _System_IsIconic(hwnd) As Boolean
 	End Function
 
@@ -705,10 +703,10 @@
 	End Sub
 
-	Const Function ProcessID() As DWord
-		GetWindowProcessThreadId(ProcessID)
-	End Function
-
-	Const Function ThreadID() As DWord
-		Return GetWindowProcessThreadId(ByVal 0)
+	Const Function ProcessId() As DWord
+		GetWindowThreadProcessId(ProcessId)
+	End Function
+
+	Const Function ThreadId() As DWord
+		Return GetWindowThreadProcessId(ByVal 0)
 	End Function
 
@@ -759,5 +757,5 @@
 		Return GetWindowTextLength(hwnd)
 	End Function
-
+#ifdef _UNDEF
 	Const Function UserData() As LONG_PTR
 		Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)
@@ -767,7 +765,7 @@
 		_System_SetWindowLongPtr(hwnd, GWLP_USERDATA, newValue)
 	End Sub
-
+#endif
 	Const Function Visible() As Boolean
-		Return IsVisible(hwnd) As Boolean
+		Return IsWindowVisible(hwnd) As Boolean
 	End Function
 
@@ -779,5 +777,5 @@
 		EndIf
 	End Sub
-
+#ifdef _UNDEF
 	Const Function WindowPlacement() As WINDOWPLACEMENT
 		WindowPlacement.length = Len(WindowPlacement)
@@ -796,5 +794,5 @@
 		_System_SetWindowLongPtr(hwnd, GWLP_WNDPROC, newWndProc As LONG_PTR)
 	End Sub
-
+#endif
 Protected
 	Sub SetHWnd(hwndNew As HWND)
@@ -803,3 +801,4 @@
 End Class
 
-#endif '__WINDOWS_WINDOWHANDLE_SBP__
+End Namespace 'Widnows
+End Namespace 'ActiveBasic
