Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ApplicationEvent.sbp
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ApplicationEvent.sbp	(revision 611)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ApplicationEvent.sbp	(revision 615)
@@ -13,9 +13,10 @@
 	End Sub
 Protected
-	Static Sub OnThreadExit(e As Args)
+	Static Function OnThreadExit(e As Args) As Boolean
 		If Not IsNothing(threadExit) Then
 			threadExit(This, e)
+			Return True
 		End If
-	End Sub
+	End Function
 Private
 	Static threadExit As Handler
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Control.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Control.ab	(revision 611)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Control.ab	(revision 615)
@@ -12,4 +12,8 @@
 End Namespace
 
+/*
+@brief Windowsのウィンドウを管理する基底クラス
+@auther Egtra
+*/
 Class Control
 	Inherits WindowHandle
@@ -24,7 +28,4 @@
 	Sub Control()
 		comImpl = New COM.ComClassDelegationImpl(This)
-	End Sub
-
-	Virtual Sub ~Control()
 	End Sub
 
@@ -52,11 +53,4 @@
 '--------------------------------
 ' ウィンドウ作成
-'	Function Create(
-'		parent As HWND,
-'		rect As RECT,
-'		name As String,
-'		style As DWord,
-'		exStyle = 0 As DWord,
-'		menu = 0 As HMENU) As HWND
 
 Public
@@ -108,11 +102,10 @@
 		CreateEx(parent, style Or WS_CHILD Or WS_VISIBLE, exStyle, id As ULONG_PTR As HMENU)
 	End Sub
+
 Protected
 	Abstract Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
 
 	Sub createImpl(ByRef cs As CREATESTRUCT, parent As Control)
-		If hwnd <> 0 Then
-			Throw New System.InvalidOperationException("Window already created.")
-		End If
+		throwIfAlreadyCreated()
 
 		StartWndProc()
@@ -123,5 +116,5 @@
 				.x, .y, .cx, .cy, .hwndParent, .hMenu, .hInstance, .lpCreateParams)
 			If hwnd = 0 Then
-				ActiveBasic.Windows.ThrowWithLastError()
+				ThrowWithLastErrorNT("Control.CreateEx")
 			End If
 			
@@ -134,4 +127,22 @@
 		If IsNothing(parent) = False Then
 			RegisterUnassociateHWnd(parent)
+		End If
+	End Sub
+
+Public
+	Sub Attach(hwndNew As HWND)
+		throwIfAlreadyCreated()
+		If hwndNew = 0 Then
+			Throw New System.ArgumentNullException("Control.Attach")
+		End If
+		registerStandardEvent()
+		AssociateHWnd(hwndNew)
+		prevWndProc = SetWindowLongPtr(GWLP_WNDPROC, AddressOf(WndProcFirst) As LONG_PTR) As WNDPROC
+	End Sub
+
+Private
+	Sub throwIfAlreadyCreated()
+		If hwnd <> 0 Then
+			Throw New System.InvalidOperationException("Window already created.")
 		End If
 	End Sub
@@ -148,6 +159,8 @@
 				Dim a = New MessageArgs(hwnd, msg, wp, lp)
 				h(This, a)
-				WndProc = a.LResult
-				Exit Function
+				If a.Handled Then
+					WndProc = a.LResult
+					Exit Function
+				End If
 			End If
 		End If
@@ -156,5 +169,9 @@
 
 	Virtual Function DefWndProc(msg As DWord, wp As WPARAM, lp As LPARAM) As LRESULT
-		DefWndProc = DefWindowProc(hwnd, msg, wp, lp)
+		If prevWndProc Then
+			DefWndProc = CallWindowProc(prevWndProc, hwnd, msg, wp, lp)
+		Else
+			DefWndProc = DefWindowProc(hwnd, msg, wp, lp)
+		End If
 	End Function
 
@@ -219,15 +236,11 @@
 
 	Sub OnEraseBackground(sender As Object, e As MessageArgs)
-		If IsNothing(paintBackground) Then
-			Dim rc = ClientRect
-			FillRect(e.WParam As HDC, rc, (COLOR_3DFACE + 1) As HBRUSH)
-		Else
-			OnPaintBackground(New PaintBackgroundArgs(e.WParam, e.LParam))
-		End If
-		e.LResult = TRUE
+		Dim a = New PaintBackgroundArgs(e.WParam, e.LParam)
+		e.Handled = e.Handled And OnPaintBackground(a)
+		e.LResult = a.Painted
 	End Sub
 
 	Sub OnMouseDownBase(sender As Object, e As MessageArgs)
-		OnMouseDown(makeMouseEventFromMsg(e))
+		e.Handled = e.Handled And OnMouseDown(makeMouseEventFromMsg(e))
 	End Sub
 
@@ -240,5 +253,5 @@
 			doubleClickFired = False
 		End If
-		OnMouseUp(me)
+		e.Handled = e.Handled And OnMouseUp(me)
 	End Sub
 
@@ -248,5 +261,5 @@
 		OnMouseDown(me)
 		OnDoubleClick(Args.Empty)
-		OnMouseDoubleClick(me)
+		e.Handled = e.Handled And OnMouseDoubleClick(me)
 	End Sub
 
@@ -258,9 +271,9 @@
 			trackMouseEvent(TME_LEAVE Or TME_HOVER)
 		End If
-		OnMouseMove(me)
+		e.Handled = e.Handled And OnMouseMove(me)
 	End Sub
 
 	Sub OnMouseLeaveBase(sender As Object, e As MessageArgs)
-		OnMouseLeave(Args.Empty)
+		e.Handled = e.Handled And OnMouseLeave(Args.Empty)
 		mouseEntered = False
 	End Sub
@@ -268,35 +281,39 @@
 	Sub OnMouseHoverBase(sender As Object, e As MessageArgs)
 		Dim me = makeMouseEventFromMsg(e)
-		OnMouseHover(me)
+		e.Handled = e.Handled And OnMouseHover(me)
 	End Sub
 
 	Sub OnPaintBase(sender As Object, e As MessageArgs)
-		Dim ps As PAINTSTRUCT
-		BeginPaint(ps)
-		Try
-			OnPaintDC(New PaintDCArgs(ps.hdc, ps.rcPaint))
-		Finally
-			EndPaint(ps)
-		End Try
+		If ActiveBasic.IsNothing(paintDC) Then
+			e.Handled = False
+		Else
+			Dim ps As PAINTSTRUCT
+			BeginPaint(ps)
+			Try
+				OnPaintDC(New PaintDCArgs(ps.hdc, ps.rcPaint))
+			Finally
+				EndPaint(ps)
+			End Try
+		End If
 	End Sub
 
 	Sub OnKeyDownBase(sender As Object, e As MessageArgs)
-		OnKeyDown(New KeyArgs(makeKeysFormMsg(e)))
+		e.Handled = e.Handled And OnKeyDown(New KeyArgs(makeKeysFormMsg(e)))
 	End Sub
 
 	Sub OnKeyUpBase(sender As Object, e As MessageArgs)
-		OnKeyUp(New KeyArgs(makeKeysFormMsg(e)))
+		e.Handled = e.Handled And OnKeyUp(New KeyArgs(makeKeysFormMsg(e)))
 	End Sub
 
 	Sub OnChar(sender As Object, e As MessageArgs)
-		OnKeyPress(New KeyPressArgs(e.WParam As Char))
+		e.Handled = e.Handled And OnKeyPress(New KeyPressArgs(e.WParam As Char))
 	End Sub
 
 	Sub OnCreateBase(sender As Object, e As MessageArgs)
-		OnCreate(New CreateArgs(e.LParam As *CREATESTRUCT))
+		e.Handled = e.Handled And OnCreate(New CreateArgs(e.LParam As *CREATESTRUCT))
 	End Sub
 
 	Sub OnSize(sender As Object, e As MessageArgs)
-		OnResize(New ResizeArgs(e.WParam, e.LParam))
+		e.Handled = e.Handled And OnResize(New ResizeArgs(e.WParam, e.LParam))
 	End Sub
 
@@ -352,4 +369,10 @@
 Private
 	/*!
+	@brief	サブクラス化前のウィンドウプロシージャ
+	@date	2008/08/23
+	サブクラス化していなければNULL
+	*/
+	prevWndProc As WNDPROC
+	/*!
 	@brief マウスカーソルがクライアント領域に入っているかどうかのフラグ
 	外から中に入ってきたときにMouseEnterイベントを発生させるために用意している。
@@ -381,9 +404,9 @@
 		If msg = WM_NCDESTROY Then
 			rThis.UnassociateHWnd()
+			rThis.hwnd = 0
 		End If
 		If msg = WM_DESTROY And IsNothing(rThis.finalDestroy) = False Then
 			Dim f = rThis.finalDestroy
 			f(rThis, Args.Empty)
-'			finalDestroy(This, Args.Empty)
 		End If
 		WndProcFirst = rThis.WndProc(msg, wp, lp)
@@ -391,6 +414,6 @@
 
 	*InstanceIsNotFound
-		Dim err = "ActiveBasic.Windows.UI.Control.WndProcFirst: The attached instance is not found. msg = &h" _
-			+ Hex$(msg) + Ex"\r\n"
+		Dim err = String.Concat("Control.WndProcFirst: The attached instance is not found. msg = &h",
+			Hex$(msg), Ex"\r\n")
 		OutputDebugString(ToTCStr(err))
 		WndProcFirst = DefWindowProc(hwnd, msg, wp, lp)
@@ -399,12 +422,12 @@
 	/*!
 	@brief	Controlインスタンスとウィンドウハンドルを結び付ける。
-	@param[in] hwnd	結び付けるウィンドウハンドル
+	@param[in] hwndNew	結び付けるウィンドウハンドル
 	@date	2008/07/16
 	これを実行することで、UnassociateHWndされるまでControlがGC対象にならなくなると共に、
 	FromHWndでウィンドウハンドルからControlインスタンスの取得が可能となる。
 	*/
-	Sub AssociateHWnd(hwnd As HWND)
-		This.hwnd = hwnd
-		This.Prop[PropertyInstance] = ObjPtr(This) As HANDLE
+	Sub AssociateHWnd(hwndNew As HWND)
+		hwnd = hwndNew
+		Prop[PropertyInstance] = ObjPtr(This) As HANDLE
 		comImpl.AddRef()
 	End Sub
@@ -429,4 +452,5 @@
 	Sub UnassociateHWndOnEvent(sender As Object, e As Args)
 		UnassociateHWnd()
+		hwnd = 0
 	End Sub
 
@@ -447,5 +471,14 @@
 
 Private
+	/*!
+	@brief ウィンドウの寿命管理
+	Controlには次のAddRef-Releaseの対がある。
+	@li createImpl - WM_NCDESTROY（ウィンドウプロシージャがWndProcFirstの場合）
+	@li createImpl - UnassociateHWnd←UnassociateHWndOnEvent←RegisterUnassociateHWnd（その他のウィンドウクラスの場合）
+	@li Attach - WM_NCDESTROY（サブクラス化された場合）
+	なお、Control派生クラスをサブクラス化すると、後ろ2つが両方適用される。
+	*/
 	comImpl As COM.ComClassDelegationImpl
+
 '--------------------------------
 '	その他の補助関数
@@ -526,5 +559,4 @@
 		End If
 	End Sub
-
 End Class
 
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ControlEvent.sbp
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ControlEvent.sbp	(revision 611)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ControlEvent.sbp	(revision 615)
@@ -13,9 +13,10 @@
 	End Sub
 Protected
-	Sub OnPaintDC(e As PaintDCArgs)
+	Function OnPaintDC(e As PaintDCArgs) As Boolean
 		If Not IsNothing(paintDC) Then
 			paintDC(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	paintDC As PaintDCHandler
@@ -35,9 +36,10 @@
 	End Sub
 Protected
-	Sub OnClick(e As Args)
+	Function OnClick(e As Args) As Boolean
 		If Not IsNothing(click) Then
 			click(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	click As Handler
@@ -57,9 +59,10 @@
 	End Sub
 Protected
-	Sub OnDoubleClick(e As Args)
+	Function OnDoubleClick(e As Args) As Boolean
 		If Not IsNothing(doubleClick) Then
 			doubleClick(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	doubleClick As Handler
@@ -79,9 +82,10 @@
 	End Sub
 Protected
-	Sub OnMove(e As Args)
+	Function OnMove(e As Args) As Boolean
 		If Not IsNothing(move) Then
 			move(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	move As Handler
@@ -101,9 +105,10 @@
 	End Sub
 Protected
-	Sub OnResize(e As ResizeArgs)
+	Function OnResize(e As ResizeArgs) As Boolean
 		If Not IsNothing(resize) Then
 			resize(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	resize As ResizeHandler
@@ -123,9 +128,10 @@
 	End Sub
 Protected
-	Sub OnMouseEnter(e As MouseArgs)
+	Function OnMouseEnter(e As MouseArgs) As Boolean
 		If Not IsNothing(mouseEnter) Then
 			mouseEnter(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	mouseEnter As MouseHandler
@@ -145,9 +151,10 @@
 	End Sub
 Protected
-	Sub OnMouseMove(e As MouseArgs)
+	Function OnMouseMove(e As MouseArgs) As Boolean
 		If Not IsNothing(mouseMove) Then
 			mouseMove(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	mouseMove As MouseHandler
@@ -167,9 +174,10 @@
 	End Sub
 Protected
-	Sub OnMouseHover(e As MouseArgs)
+	Function OnMouseHover(e As MouseArgs) As Boolean
 		If Not IsNothing(mouseHover) Then
 			mouseHover(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	mouseHover As MouseHandler
@@ -189,9 +197,10 @@
 	End Sub
 Protected
-	Sub OnMouseLeave(e As Args)
+	Function OnMouseLeave(e As Args) As Boolean
 		If Not IsNothing(mouseLeave) Then
 			mouseLeave(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	mouseLeave As Handler
@@ -211,9 +220,10 @@
 	End Sub
 Protected
-	Sub OnMouseDown(e As MouseArgs)
+	Function OnMouseDown(e As MouseArgs) As Boolean
 		If Not IsNothing(mouseDown) Then
 			mouseDown(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	mouseDown As MouseHandler
@@ -233,9 +243,10 @@
 	End Sub
 Protected
-	Sub OnMouseClick(e As MouseArgs)
+	Function OnMouseClick(e As MouseArgs) As Boolean
 		If Not IsNothing(mouseClick) Then
 			mouseClick(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	mouseClick As MouseHandler
@@ -255,9 +266,10 @@
 	End Sub
 Protected
-	Sub OnMouseDoubleClick(e As MouseArgs)
+	Function OnMouseDoubleClick(e As MouseArgs) As Boolean
 		If Not IsNothing(mouseDoubleClick) Then
 			mouseDoubleClick(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	mouseDoubleClick As MouseHandler
@@ -277,9 +289,10 @@
 	End Sub
 Protected
-	Sub OnMouseUp(e As MouseArgs)
+	Function OnMouseUp(e As MouseArgs) As Boolean
 		If Not IsNothing(mouseUp) Then
 			mouseUp(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	mouseUp As MouseHandler
@@ -299,9 +312,10 @@
 	End Sub
 Protected
-	Sub OnKeyDown(e As KeyArgs)
+	Function OnKeyDown(e As KeyArgs) As Boolean
 		If Not IsNothing(keyDown) Then
 			keyDown(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	keyDown As KeyHandler
@@ -321,9 +335,10 @@
 	End Sub
 Protected
-	Sub OnKeyUp(e As KeyArgs)
+	Function OnKeyUp(e As KeyArgs) As Boolean
 		If Not IsNothing(keyUp) Then
 			keyUp(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	keyUp As KeyHandler
@@ -343,9 +358,10 @@
 	End Sub
 Protected
-	Sub OnKeyPress(e As KeyPressArgs)
+	Function OnKeyPress(e As KeyPressArgs) As Boolean
 		If Not IsNothing(keyPress) Then
 			keyPress(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	keyPress As KeyPressHandler
@@ -365,9 +381,10 @@
 	End Sub
 Protected
-	Sub OnCreate(e As CreateArgs)
+	Function OnCreate(e As CreateArgs) As Boolean
 		If Not IsNothing(create) Then
 			create(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	create As CreateHandler
@@ -387,9 +404,10 @@
 	End Sub
 Protected
-	Sub OnDestroy(e As Args)
+	Function OnDestroy(e As Args) As Boolean
 		If Not IsNothing(destroy) Then
 			destroy(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	destroy As Handler
@@ -409,9 +427,10 @@
 	End Sub
 Protected
-	Sub OnPaintBackground(e As PaintBackgroundArgs)
+	Function OnPaintBackground(e As PaintBackgroundArgs) As Boolean
 		If Not IsNothing(paintBackground) Then
 			paintBackground(This, e)
-		End If
-	End Sub
+			Return True
+		End If
+	End Function
 Private
 	paintBackground As PaintBackgroundHandler
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/EventArgs.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/EventArgs.ab	(revision 611)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/EventArgs.ab	(revision 615)
@@ -21,4 +21,5 @@
 		lp = lParam
 		lr = 0
+		handled = True
 	End Sub
 
@@ -45,4 +46,12 @@
 	Sub LResult(lResult As LRESULT)
 		lr = lResult
+	End Sub
+
+	Const Function Handled() As Boolean
+		Handled = handled
+	End Function
+
+	Sub Handled(h As Boolean)
+		handled = h
 	End Sub
 Private
@@ -52,4 +61,5 @@
 	lp As LPARAM
 	lr As LRESULT
+	handled As Boolean
 End Class
 
@@ -550,4 +560,5 @@
 	Sub PaintBackgroundArgs(hdc As HDC)
 		This.hdc = hdc
+		This.painted = True
 	End Sub
 
@@ -559,6 +570,15 @@
 		Handle = hdc
 	End Function
+
+	Const Function Painted() As Boolean
+		Painted = painted
+	End Function
+
+	Sub Painted(p As Boolean)
+		painted = p
+	End Sub
 Private
 	hdc As HDC
+	painted As Boolean
 End Class
 
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Form.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Form.ab	(revision 611)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Form.ab	(revision 615)
@@ -18,5 +18,6 @@
 Public
 	Sub Form()
-		AddMessageEvent(WM_COMMAND, AddressOf (OnCommand))
+		AddMessageEvent(WM_COMMAND, AddressOf(OnCommand))
+		AddPaintBackground(AddressOf(OnPaintBackground))
 	End Sub
 
@@ -30,4 +31,9 @@
 			.cy = CW_USEDEFAULT
 		End With
+	End Sub
+
+	Sub OnPaintBackground(sender As Object, e As PaintBackgroundArgs)
+		Dim rc = ClientRect
+		FillRect(e.Handle, rc, (COLOR_3DFACE + 1) As HBRUSH)
 	End Sub
 
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/FormEvent.sbp
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/FormEvent.sbp	(revision 611)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/FormEvent.sbp	(revision 615)
@@ -13,9 +13,10 @@
 	End Sub
 Protected
-	Sub OnQueryClose(e As FormClosingArgs)
+	Function OnQueryClose(e As FormClosingArgs) As Boolean
 		If Not IsNothing(queryClose) Then
 			queryClose(This, e)
+			Return True
 		End If
-	End Sub
+	End Function
 Private
 	queryClose As FormClosingHandler
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/MakeControlEventHandler.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/MakeControlEventHandler.ab	(revision 611)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/MakeControlEventHandler.ab	(revision 615)
@@ -46,9 +46,10 @@
 '	out.WriteLine(Ex"\t@brief " & comment)
 '	out.WriteLine(Ex"\t*/")
-	out.WriteLine(Ex"\t" & staticKeyword & "Sub On" & eventName & "(e As " & argsType & ")")
+	out.WriteLine(Ex"\t" & staticKeyword & "Function On" & eventName & "(e As " & argsType & ") As Boolean")
 	out.WriteLine(Ex"\t\tIf Not IsNothing(" & eventMember & ") Then")
 	out.WriteLine(Ex"\t\t\t" & eventMember & "(This, e)")
+	out.WriteLine(Ex"\t\t\tReturn True")
 	out.WriteLine(Ex"\t\tEnd If")
-	out.WriteLine(Ex"\tEnd Sub")
+	out.WriteLine(Ex"\tEnd Function")
 	out.WriteLine("Private")
 	out.WriteLine(Ex"\t" & staticKeyword & eventMember & " As " & handlerType)
@@ -72,5 +73,5 @@
 				Dim a = ActiveBasic.Strings.Detail.Split(s, 9) 'Tab
 				If a.Count >= 3 Then
-					OutputEventHandlerCode(out, a[0], a[1], a[2], isStatic)
+					OutputEventHandlerCode(out, a.Item[0], a.Item[1], a.Item[2], isStatic)
 				End If
 			Loop
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/WindowHandle.sbp
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/WindowHandle.sbp	(revision 611)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/WindowHandle.sbp	(revision 615)
@@ -547,10 +547,10 @@
 		_System_SetWindowLongPtr(hwnd, GWLP_ID, newId)
 	End Sub
-
+#endif
 	Function DlgItem(idDlgItem As Long) As WindowHandle
 		Dim w As WindowHandle(GetDlgItem(hwnd, idDlgItem))
 		Return w
 	End Function
-#endif
+
 	Const Function ExStyle() As DWord
 		Return _System_GetWindowLongPtr(hwnd, GWL_EXSTYLE) As DWord
