Index: trunk/ab5.0/ablib/TestCase/UI_Sample/UI_Sample.manifest.xml
===================================================================
--- trunk/ab5.0/ablib/TestCase/UI_Sample/UI_Sample.manifest.xml	(revision 561)
+++ trunk/ab5.0/ablib/TestCase/UI_Sample/UI_Sample.manifest.xml	(revision 561)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+	<description>UI_Sample</description>
+	<dependency>
+		<dependentAssembly>
+			<assemblyIdentity
+				type="win32"
+				name="Microsoft.Windows.Common-Controls"
+				version="6.0.0.0"
+				processorArchitecture="*"
+				publicKeyToken="6595b64144ccf1df"
+				language="*" />
+		</dependentAssembly>
+	</dependency>
+	<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+		<security>
+			<requestedPrivileges>
+				<requestedExecutionLevel
+					level="asInvoker"
+					uiAccess="false"/>
+			</requestedPrivileges>
+		</security>
+	</trustInfo>
+</assembly>
Index: trunk/ab5.0/ablib/TestCase/UI_Sample/UI_Sample.rc
===================================================================
--- trunk/ab5.0/ablib/TestCase/UI_Sample/UI_Sample.rc	(revision 561)
+++ trunk/ab5.0/ablib/TestCase/UI_Sample/UI_Sample.rc	(revision 561)
@@ -0,0 +1,1 @@
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "UI_Sample.manifest.xml"
Index: trunk/ab5.0/ablib/TestCase/UI_Sample/step11_TextEditoer.ab
===================================================================
--- trunk/ab5.0/ablib/TestCase/UI_Sample/step11_TextEditoer.ab	(revision 561)
+++ trunk/ab5.0/ablib/TestCase/UI_Sample/step11_TextEditoer.ab	(revision 561)
@@ -0,0 +1,40 @@
+/*!
+@file
+@brief 「Win32プログラミング講座 ～ Step11. テキスト エディタを作る ～」のAB5移植版
+http://www.activebasic.com/help_center/articles/win32/step05/
+まだメニューバーがないんでそれっぽくありません。
+
+@date 2008/07/20
+@auther Egtra
+*/
+
+#require <Classes/ActiveBasic/Windows/UI/Application.ab>
+#require <Classes/ActiveBasic/Windows/UI/Form.ab>
+#require <Classes/ActiveBasic/Windows/UI/EditBox.ab>
+
+#resource "UI_Sample.rc"
+
+Imports ActiveBasic.Windows.UI
+
+Class MyForm
+	Inherits Form
+Public
+	Sub MyForm()
+		AddResize(AddressOf(OnResize))
+		Create()
+		myEdit = New EditBox
+		myEdit.Create(This, ES_MULTILINE Or ES_WANTRETURN Or ES_AUTOHSCROLL Or ES_AUTOVSCROLL Or WS_HSCROLL Or WS_VSCROLL, WS_EX_CLIENTEDGE)
+		myEdit.SendMessage(WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT) As WPARAM, 0)
+		Show(SW_SHOWDEFAULT)
+	End Sub
+
+	Sub OnResize(sender As Object, e As ResizeArgs)
+		myEdit.Move(0, 0, e.X, e.Y)
+	End Sub
+Private
+	myEdit As EditBox
+End Class
+
+Control.Initialize(GetModuleHandle(0))
+
+Application.Run(New MyForm)
Index: trunk/ab5.0/ablib/TestCase/UI_Sample/step5_DayTimeCheck.ab
===================================================================
--- trunk/ab5.0/ablib/TestCase/UI_Sample/step5_DayTimeCheck.ab	(revision 560)
+++ trunk/ab5.0/ablib/TestCase/UI_Sample/step5_DayTimeCheck.ab	(revision 561)
@@ -1,13 +1,20 @@
-'「Win32プログラミング講座 ～ Step5. ボタン コントロールを使う ～」のAB5移植版
-'http://www.activebasic.com/help_center/articles/win32/step05/
+/*!
+@file
+@brief 「Win32プログラミング講座 ～ Step5. ボタン コントロールを使う ～」のAB5移植版
+http://www.activebasic.com/help_center/articles/win32/step05/
 
-'2008/07/20 Egtra
+@date 2008/07/20
+@auther Egtra
+*/
 
 #require <Classes/ActiveBasic/Windows/UI/Form.ab>
 #require <Classes/ActiveBasic/Windows/UI/Application.ab>
 #require <Classes/ActiveBasic/Windows/UI/Button.ab>
+#require <Classes/ActiveBasic/Windows/UI/TaskMsg.ab>
 
 Imports ActiveBasic.Windows.UI
 Imports System
+
+#resource "UI_Sample.rc"
 
 Class DayTimeCheckForm
@@ -51,9 +58,9 @@
 
 	Sub ButtonDate_Click(sender As Object, e As Args)
-		MessageBox(This, ToTCStr(DateTime.Today.GetDateTimeFormats("yyyy/MM/dd")), "今日の日付", MB_OK)
+		TaskMsg(This, "今日の日付", DateTime.Today.GetDateTimeFormats("yyyy/MM/dd"), Nothing, MB_OK)
 	End Sub
 
 	Sub ButtonTime_Click(sender As Object, e As Args)
-		MessageBox(This, ToTCStr(DateTime.Now.GetDateTimeFormats("H:mm:ss")), "今日の日付", MB_OK)
+		TaskMsg(This, "今日の日付", DateTime.Now.GetDateTimeFormats("H:mm:ss"), Nothing, MB_OK)
 	End Sub
 
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Button.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Button.ab	(revision 560)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Button.ab	(revision 561)
@@ -19,13 +19,8 @@
 			.lpszClass = "BUTTON"
 			.style Or= BS_PUSHBUTTON
-			.x = 0
-			.y = 0
-			.cx = 0
-			.cy = 0
 		End With
 	End Sub
 Public
 	Sub RaiseClick()
-		OutputDebugString(Ex"RaiseClick\r\n")
 		OnClick(Args.Empty)
 	End Sub
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Control.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Control.ab	(revision 560)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Control.ab	(revision 561)
@@ -65,8 +65,8 @@
 			.lpszName = 0
 			.style = style Or WS_CHILD Or WS_VISIBLE
-			.x = CW_USEDEFAULT
-			.y = CW_USEDEFAULT
-			.cx = CW_USEDEFAULT
-			.cy = CW_USEDEFAULT
+			.x = 0
+			.y = 0
+			.cx = 0
+			.cy = 0
 			If IsNothing(parent) Then
 				.hwndParent = 0
@@ -101,5 +101,5 @@
 
 		With cs
-			'よそのクラスの場合、WndProcFirst内のhwndの代入が行われないため、ここでも行っておく。
+			'よそのウィンドウクラスの場合、WndProcFirst内のhwndの代入が行われないため、ここでも行っておく。
 			hwnd = CreateWindowEx(.dwExStyle, .lpszClass, .lpszName, .style,
 				.x, .y, .cx, .cy, .hwndParent, .hMenu, .hInstance, .lpCreateParams)
@@ -187,4 +187,5 @@
 		AddMessageEvent(WM_CHAR, AddressOf(OnChar))	
 		AddMessageEvent(WM_CREATE, AddressOf(OnCreateBase))
+		AddMessageEvent(WM_SIZE, AddressOf(OnSize))
 	End Sub
 
@@ -202,5 +203,5 @@
 		Dim me = makeMouseEventFromMsg(e)
 		If doubleClickFired = False Then
-'			OnClick(System.Args.Empty)
+			OnClick(Args.Empty)
 			OnMouseClick(me)
 			doubleClickFired = False
@@ -213,5 +214,5 @@
 		doubleClickFired = True
 		OnMouseDown(me)
-'		OnDoubleClick(System.Args.Empty)
+		OnDoubleClick(Args.Empty)
 		OnMouseDoubleClick(me)
 	End Sub
@@ -257,4 +258,8 @@
 	Sub OnCreateBase(sender As Object, e As MessageArgs)
 		OnCreate(New CreateArgs(e.LParam As *CREATESTRUCT))
+	End Sub
+
+	Sub OnSize(sender As Object, e As MessageArgs)
+		OnResize(New ResizeArgs(e.WParam, e.LParam))
 	End Sub
 
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ControlEvent.sbp
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ControlEvent.sbp	(revision 560)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ControlEvent.sbp	(revision 561)
@@ -88,4 +88,26 @@
 
 Public
+	Sub AddResize(h As ResizeHandler)
+		If IsNothing(resize) Then
+			resize = h
+		Else
+			resize += h
+		End If
+	End Sub
+	Sub RemoveResize(h As ResizeHandler)
+		If Not IsNothing(resize) Then
+			resize -= h
+		End If
+	End Sub
+Protected
+	Sub OnResize(e As ResizeArgs)
+		If Not IsNothing(resize) Then
+			resize(This, e)
+		End If
+	End Sub
+Private
+	resize As ResizeHandler
+
+Public
 	Sub AddMouseEnter(h As MouseHandler)
 		If IsNothing(mouseEnter) Then
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ControlEventList.txt
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ControlEventList.txt	(revision 560)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/ControlEventList.txt	(revision 561)
@@ -4,5 +4,5 @@
 'EnableChanged		有効状態が変化したときに呼び出されます。
 Move		ウィンドウが移動したときに呼び出されます。
-'Resize		ウィンドウの大きさが変化したときに呼び出されます。
+Resize	Resize	ウィンドウの大きさが変化したときに呼び出されます。
 'VisibleChanged		ウィンドウの表示状態が変化したときに呼び出されます。
 'SetFocus		フォーカスを得たときに呼び出されます。
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/EditBox.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/EditBox.ab	(revision 561)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/EditBox.ab	(revision 561)
@@ -0,0 +1,28 @@
+'Classes/ActiveBasic/Windows/UI/EditBox.ab
+#require <Classes/ActiveBasic/Windows/UI/Control.ab>
+
+Namespace ActiveBasic
+Namespace Windows
+Namespace UI
+
+/*!
+@brief エディトコントロールのクラス
+@date 2007/07/21
+@auther Egtra
+*/
+Class EditBox
+	Inherits Control
+Protected
+	Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
+		With cs
+			.lpszClass = "EDIT"
+		End With
+	End Sub
+
+	'ToDo: Lineなどを設ける
+End Class
+
+End Namespace 'UI
+End Namespace 'Widnows
+End Namespace 'ActiveBasic
+
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/EventArgs.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/EventArgs.ab	(revision 560)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/EventArgs.ab	(revision 561)
@@ -23,21 +23,21 @@
 	End Sub
 
-	Function Msg() As DWord
+	Const Function Msg() As DWord
 		Msg = msg
 	End Function
 
-'	Function HWnd() As HWND
+'	Const Function HWnd() As HWND
 '		HWnd = hwnd
 '	End Function
 
-	Function WParam() As WPARAM
+	Const Function WParam() As WPARAM
 		WParam = wp
 	End Function
 
-	Function LParam() As LPARAM
+	Const Function LParam() As LPARAM
 		LParam = lp
 	End Function
 
-	Function LResult() As LRESULT
+	Const Function LResult() As LRESULT
 		LResult = lr
 	End Function
@@ -64,9 +64,9 @@
 	End Sub
 
-	Function Handle() As HDC
+	Const Function Handle() As HDC
 		Handle = hdc
 	End Function
 
-	Function ClipRect() As RECT
+	Const Function ClipRect() As RECT
 		ClipRect = rc
 	End Function
@@ -86,5 +86,5 @@
 	End Sub
 
-	Function Handled() As Boolean
+	Const Function Handled() As Boolean
 		Handled = h
 	End Function
@@ -386,17 +386,17 @@
 	End Sub
 
-	Function Alt() As Boolean
+	Const Function Alt() As Boolean
 		Alt = key And Keys.Menu
 	End Function
 
-	Function Control() As Boolean
+	Const Function Control() As Boolean
 		Control = key And Keys.Control
 	End Function
 
-	Function Shift() As Boolean
+	Const Function Shift() As Boolean
 		Shift = key And Keys.Shift
 	End Function
 
-	Function KeyCode() As Keys
+	Const Function KeyCode() As Keys
 		Dim k = key As DWord
 		Dim mask = Keys.KeyCode As DWord
@@ -404,9 +404,9 @@
 	End Function
 
-	Function KeyData() As Keys
+	Const Function KeyData() As Keys
 		KeyData = key
 	End Function
 
-	Function Modifiers() As Keys
+	Const Function Modifiers() As Keys
 		Dim k = key As DWord
 		Dim mask = Keys.Modifiers As DWord
@@ -414,5 +414,5 @@
 	End Function
 
-	Function KeyValue() As Long
+	Const Function KeyValue() As Long
 		KeyValue = key As Long
 	End Function
@@ -422,5 +422,5 @@
 	End Sub
 
-	Function Handled() As Boolean
+	Const Function Handled() As Boolean
 		Handled = h
 	End Function
@@ -498,5 +498,5 @@
 	End Sub
 
-	Function Cancel() As Boolean
+	Const Function Cancel() As Boolean
 		Cancel = c
 	End Function
@@ -510,4 +510,38 @@
 
 Delegate Sub FormClosingHandler(sender As Object, e As FormClosingArgs)
+
+Class ResizeArgs
+	Inherits Args
+Public
+	Sub ResizeArgs(resizeType As Long, X As Long, Y As Long)
+		rt = resizeType
+		x = X
+		y = Y
+	End Sub
+
+	Sub ResizeArgs(wp As WPARAM, lp As LPARAM)
+		rt = wp As Long
+		x = GET_X_LPARAM(lp)
+		y = GET_Y_LPARAM(lp)
+	End Sub
+
+	Function ResizeType() As Long
+		ResizeType = rt
+	End Function
+
+	Function X() As Long
+		X = x
+	End Function
+
+	Function Y() As Long
+		Y = y
+	End Function
+Private
+	rt As Long
+	x As Long
+	y As Long
+End Class
+
+Delegate Sub ResizeHandler(sender As Object, e As ResizeArgs)
 
 End Namespace 'UI
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Form.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Form.ab	(revision 560)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Form.ab	(revision 561)
@@ -23,5 +23,11 @@
 Protected
 	Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
-		cs.style = WS_OVERLAPPEDWINDOW
+		With cs
+			.style = WS_OVERLAPPEDWINDOW
+			.x = CW_USEDEFAULT
+			.y = CW_USEDEFAULT
+			.cx = CW_USEDEFAULT
+			.cy = CW_USEDEFAULT
+		End With
 	End Sub
 
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/TaskMsg.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/TaskMsg.ab	(revision 561)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/TaskMsg.ab	(revision 561)
@@ -0,0 +1,110 @@
+'Classes/ActiveBasic/Windows/UI/TaskDialog.ab
+
+Namespace ActiveBasic
+Namespace Windows
+Namespace UI
+Namespace Detail
+
+/*!
+@brief TaskMsgの実装担当。
+@date 2008/06/27
+@auther Egtra
+*/
+Function ShowTaskDialog(hwndOwner As HWND, title As String, instruction As String, comment As String, mbType As DWord, mbIcon As DWord, ByRef button As Long) As HRESULT
+	'TaskDialog関数で表示できないもの (Case Else) をエラーにするため、
+	'TaskDialogを使わない場合でもこのSelectを通るようにしている。
+	Dim buttonFlags As TASKDIALOG_COMMON_BUTTON_FLAGS
+	Select Case mbType
+		Case MB_YESNOCANCEL
+			buttonFlags = TDCBF_YES_BUTTON Or TDCBF_NO_BUTTON Or TDCBF_CANCEL_BUTTON
+		Case MB_YESNO
+			buttonFlags = TDCBF_YES_BUTTON Or TDCBF_NO_BUTTON
+		Case MB_RETRYCANCEL
+			buttonFlags = TDCBF_RETRY_BUTTON Or TDCBF_CANCEL_BUTTON
+		Case MB_OKCANCEL
+			buttonFlags = TDCBF_OK_BUTTON Or TDCBF_CANCEL_BUTTON
+		Case MB_OK
+			buttonFlags = TDCBF_OK_BUTTON
+		Case Else
+			ShowTaskDialog = E_INVALIDARG
+			Exit Function
+	End Select
+	'同様の理由でアイコンのフラグも確認する。
+	Dim icon As PCWSTR
+	Select Case mbIcon
+		Case MB_ICONEXCLAMATION
+			icon = TD_WARNING_ICON
+		Case 0, MB_ICONQUESTION
+			icon = 0
+		Case MB_ICONHAND
+			icon = TD_ERROR_ICON
+		Case MB_ICONASTERISK
+			icon = TD_INFORMATION_ICON
+		Case Else
+			ShowTaskDialog = E_INVALIDARG
+			Exit Function
+	End Select
+
+	If IsNothing(title) Then
+		title = "" 'TaskDialogとMessageBoxで表示内容が異なるので統一
+	End If
+
+	Dim hmodComCtl = GetModuleHandle("comctl32.dll")
+	If hmodComCtl <> 0 Then
+		Dim pTaskDialog = GetProcAddress(hmodComCtl, ToMBStr("TaskDialog")) As PTaskDialog
+		If pTaskDialog <> 0 Then
+			ShowTaskDialog = pTaskDialog(hwndOwner, 0, ToWCStr(title), ToWCStr(instruction), ToWCStr(comment), buttonFlags, icon, VarPtr(button))
+			If SUCCEEDED(ShowTaskDialog) Then
+				Exit Function
+			End If
+			'だめだったら、MessageBoxを試みる。
+		End If
+	End If
+
+	Dim msg = instruction
+	If Not String.IsNullOrEmpty(comment) Then
+		msg += Ex"\r\n\r\n" + comment
+	End If
+	Dim b = MessageBox(hwndOwner, StrPtr(msg), StrPtr(title), mbType Or mbIcon)
+	If b = 0 Then
+		ShowTaskDialog = HRESULT_FROM_WIN32(GetLastError())
+	Else
+		button = b
+		ShowTaskDialog = S_OK
+	End If
+End Function
+
+TypeDef PTaskDialog = *Function( _
+	hwnd As HWND,
+	hinst As HINSTANCE,
+	pszWindowTitle As PCWSTR,
+	pszMainInstruction As PCWSTR,
+	pszComment As PCWSTR,
+	dwCommonButtons As TASKDIALOG_COMMON_BUTTON_FLAGS,
+	pszIcon As PCWSTR,
+	ByVal pnButton As *Long
+) As HRESULT
+
+End Namespace 'Detail
+
+/*!
+@brief TaskDialogが使えるときはそれを、ないときにはMessageBoxを表示する。
+@param[in] hwndOwner オーナーウィンドウ（無ければNULL）。
+@param[in] title タイトル（Nothingでも良いがそのときの表示内容は未定）。
+@param[in] instruction メッセージ内容となるテキスト。
+@param[in] comment 補足説明となるテキスト（Nothingでも良い）。
+@param[in] mbType 選択肢の指定、MB_YESNOCANCEL, MB_YESNO, MB_RETRYCANCEL, MB_OKCANCEL, MB_OKに対応。
+@param[in] mbIcon アイコン、0（なし）, MB_ICONEXCLAMATION, MB_ICONHAND, MB_ICONASTERISKに対応。MB_ICONQUESTIONも指定可能だが無視される（0と同じ）。
+@return ユーザの押したものに応じてIDCANCEL, IDNO, IDOK, IDRETRY, IDYESのいずれか。
+@throw 何かエラーが起こったらException（またはその派生）が投げられる。
+@date 2008/07/21
+@auther Egtra
+*/
+Function TaskMsg(hwndOwner As HWND, title As String, instruction As String, comment = Nothing As String, mbType = MB_OK As DWord, mbIcon = 0 As DWord) As Long
+	Dim hr = Detail.ShowTaskDialog(hwndOwner, title, instruction, comment, mbType, mbIcon, TaskMsg)
+	ThrowIfFailed(hr)
+End Function
+
+End Namespace 'UI
+End Namespace 'Widnows
+End Namespace 'ActiveBasic
Index: trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/Windows.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/Windows.ab	(revision 560)
+++ trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/Windows.ab	(revision 561)
@@ -128,5 +128,5 @@
 hrが成功値 (FAILED(hr) = False) の場合、この関数は何も行わない。
 */
-Sub ThrowByHResult(hr As HRESULT)
+Sub ThrowIfFailed(hr As HRESULT)
 	If FAILED(hr) Then
 		Throw New WindowsException(hr)
Index: trunk/ab5.0/ablib/src/api_commctrl.sbp
===================================================================
--- trunk/ab5.0/ablib/src/api_commctrl.sbp	(revision 560)
+++ trunk/ab5.0/ablib/src/api_commctrl.sbp	(revision 561)
@@ -999,3 +999,19 @@
 Declare Function _TrackMouseEvent Lib "comctl32" (ByRef EventTrack As TRACKMOUSEEVENT) As BOOL
 
+Const TD_WARNING_ICON = MAKEINTRESOURCEW(&hffff /*-1*/)
+Const TD_ERROR_ICON = MAKEINTRESOURCEW(&hfffe /*-2*/)
+Const TD_INFORMATION_ICON = MAKEINTRESOURCEW(&hfffd /*-3*/)
+Const TD_SHIELD_ICON = MAKEINTRESOURCEW(&hfffc /*-4*/)
+
+Const Enum _TASKDIALOG_COMMON_BUTTON_FLAGS
+	TDCBF_OK_BUTTON = &h0001
+	TDCBF_YES_BUTTON = &h0002
+	TDCBF_NO_BUTTON = &h0004
+	TDCBF_CANCEL_BUTTON = &h0008
+	TDCBF_RETRY_BUTTON = &h0010
+	TDCBF_CLOSE_BUTTON = &h0020
+End Enum
+
+TypeDef TASKDIALOG_COMMON_BUTTON_FLAGS = Long
+
 #endif '_INC_COMMCTRL
