Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/WindowHandle.sbp
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/WindowHandle.sbp	(revision 545)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/WindowHandle.sbp	(revision 547)
@@ -31,7 +31,4 @@
 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_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
-Declare Function _System_SetProp Lib "user32" Alias _FuncName_SetProp (hWnd As HWND, pString As PCTSTR, hData As HANDLE) As BOOL
 Declare Function _System_GetClassName Lib "user32" Alias _FuncName_GetClassName (hWnd As HWND, lpClassName As PTSTR, nMaxCount As Long) As Long
 Declare Function _System_GetScrollInfo Lib "user32" Alias "GetScrollInfo" (hWnd As HWND, fnBar As Long, ByRef lpsi As SCROLLINFO) As BOOL
@@ -69,5 +66,12 @@
 		Return hwnd
 	End Function
-
+/*
+	Static Function FromHWnd(hwnd As HWND) As WindowHandle
+		FromHWnd = Control.FromHWnd(hwnd)
+		If IsNothing(FromHWnd) Then
+			FromHWnd = New WindowHandle(hwnd)
+		End If
+	End Function
+*/
 	Function BringToTop() As Boolean
 		Return BringWindowToTop(hwnd) As Boolean
@@ -76,4 +80,8 @@
 	Function BeginPaint(ByRef ps As PAINTSTRUCT) As HDC
 		Return _System_BeginPaint(hwnd, ps)
+	End Function
+
+	Function BeginPaint() As PAINTSTRUCT
+		_System_BeginPaint(hwnd, BeginPaint)
 	End Function
 /*
@@ -139,7 +147,4 @@
 	End Function
 
-	Const Function GetClientRect(ByRef rc As RECT) As Boolean
-		Return _System_GetClientRect(hwnd, rc) As Boolean
-	End Function
 /*
 	Const Function GetContextHelpId() As DWord
@@ -175,16 +180,4 @@
 	End Function
 */
-	Const Function GetProp(str As String) As HANDLE
-		Return _System_GetProp(hwnd, ToTCStr(str))
-	End Function
-
-	Const Function GetProp(psz As PCTSTR) As HANDLE
-		Return _System_GetProp(hwnd, psz)
-	End Function
-
-	Const Function GetProp(atom As ATOM) As HANDLE
-		Return _System_GetProp(hwnd, atom As ULONG_PTR As PCTSTR)
-	End Function
-
 	Const Function GetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO) As Boolean
 		Return _System_GetScrollInfo(hwnd, fnBar, si) As Boolean
@@ -219,18 +212,6 @@
 	End Function
 */
-	Const Function GetWindowRect(ByRef rc As RECT) As Boolean
-		Return _System_GetWindowRect(hwnd, rc) As Boolean
-	End Function
-
 	Const Function GetText(ps As PTSTR, maxCount As Long) As Boolean
 		Return GetWindowText(hwnd, ps, maxCount) As Boolean
-	End Function
-
-	Const Function GetTextLength() As Long
-		Return GetWindowTextLength(hwnd)
-	End Function
-
-	Const Function GetWindowThreadId() As DWord
-		Return _System_GetWindowThreadProcessId(hwnd, 0)
 	End Function
 
@@ -444,16 +425,4 @@
 	End Function
 
-	Function SetProp(str As String, hData As HANDLE) As Boolean
-		Return _System_SetProp(hwnd, ToTCStr(str), hData) As Boolean
-	End Function
-
-	Function SetProp(psz As PCTSTR, hData As HANDLE) As Boolean
-		Return _System_SetProp(hwnd, psz, hData) As Boolean
-	End Function
-
-	Function SetProp(atom As ATOM, hData As HANDLE) As Boolean
-		Return This.SetProp((atom As ULONG_PTR) As PCTSTR, hData) As Boolean
-	End Function
-
 	Function SetScrollInfo(fnBar As Long, ByRef si As SCROLLINFO, redraw As Boolean) As Boolean
 		Return _System_SetScrollInfo(hwnd, fnBar, si, redraw) As Boolean
@@ -502,12 +471,4 @@
 	End Function
 
-	Function SetText(psz As PCTSTR) As Boolean
-		Return SetWindowText(hwnd, psz) As Boolean
-	End Function
-
-	Function SetText(str As String) As Boolean
-		Return SetWindowText(hwnd, ToTCStr(str)) As Boolean
-	End Function
-
 	Function ShowCaret() As Boolean
 		Return _System_ShowCaret(hwnd) As Boolean
@@ -546,46 +507,8 @@
 	End Function
 
-	' Get/SetWindowLongPtr Wrappers
-
-	Const Function GetExStyle() As DWord
-		Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
-	End Function
-
-	Const Function GetStyle() As DWord
-		Return _System_GetWindowLongPtr(hwnd, GWL_STYLE) As DWord
-	End Function
-#ifdef _UNDEF
-	Const Function GetWndProc() As WNDPROC
-		Return _System_GetWindowLongPtr(hwnd, GWLP_WNDPROC) As WNDPROC
-	End Function
-#endif
-	Const Function GetInstance() As HINSTANCE
-		Return _System_GetWindowLongPtr(hwnd, GWLP_HINSTANCE) As HINSTANCE
-	End Function
-
-	Const Function GetUserData() As LONG_PTR
-		Return _System_GetWindowLongPtr(hwnd, GWLP_USERDATA)
-	End Function
-
-	Function SetExStyle(style As DWord) As DWord
-		Return _System_SetWindowLongPtr(hwnd, GWL_EXSTYLE, style) As DWord
-	End Function
-
-	Function SetStyle(style As DWord) As DWord
-		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
-#endif
-	Function SetUserData(value As LONG_PTR) As LONG_PTR
-		Return _System_SetWindowLongPtr(hwnd, GWLP_USERDATA, value As LONG_PTR)
-	End Function
-
 	' Propaties
 
 	Const Function ClientRect() As RECT
-		_System_GetClientRect(hwnd, ClientRect)
+		GetClientRect(hwnd, ClientRect)
 	End Function
 #ifdef _UNDEF
@@ -717,28 +640,33 @@
 
 	Const Function Prop(str As String) As HANDLE
-		Return GetProp(str)
+		Return GetProp(hwnd, ToTCStr(str))
 	End Function
 
 	Const Function Prop(psz As PCTSTR) As HANDLE
-		Return GetProp(psz)
+		Return GetProp(hwnd, psz)
 	End Function
 
 	Const Function Prop(atom As ATOM) As HANDLE
-		Return GetProp(atom)
-	End Function
+		Return GetProp(hwnd, atom As ULONG_PTR As PCTSTR)
+	End Function
+
+	Sub Prop(str As String, hData As HANDLE)
+		SetProp(hwnd, ToTCStr(str), hData)
+	End Sub
 
 	Sub Prop(str As PCTSTR, h As HANDLE)
-		SetProp(str, h)
+		SetProp(hwnd, str, h)
 	End Sub
 
 	Sub Prop(atom As ATOM, h As HANDLE)
-		SetProp(atom, h)
+		SetProp(hwnd, atom As ULONG_PTR As PCTSTR, h)
 	End Sub
 
 	Const Function Text() As String
 		Dim size = GetWindowTextLength(hwnd) + 1
-		Dim p = GC_malloc_atomic(SizeOf (TCHAR) * size) As PTSTR
-		Dim length = GetWindowText(hwnd, p, size)
-		Text = New String(p, length As Long)
+		Dim sb = New System.Text.StringBuilder(size)
+		sb.Length = size
+		Dim length = GetWindowText(hwnd, StrPtr(sb), size)
+		Text = sb.ToString
 	End Function
 
