'「Win32プログラミング講座 〜 Step5. ボタン コントロールを使う 〜」のAB5移植版 'http://www.activebasic.com/help_center/articles/win32/step05/ '2008/07/20 Egtra #require #require #require Imports ActiveBasic.Windows.UI Imports System Class DayTimeCheckForm Inherits Form Public Sub DayTimeCheckForm() AddCreate(AddressOf(OnCreate)) End Sub Protected Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT) Super.GetCreateStruct(cs) With cs .style = WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_DLGFRAME Or WS_MINIMIZEBOX .cx = 140 .cy = 130 End With End Sub Private Sub OnCreate(sender As Object, e As CreateArgs) buttonDate = New Button buttonTime = New Button Dim wpHFontControl = GetStockObject(DEFAULT_GUI_FONT) As WPARAM With buttonDate .Create(This) .Text = "今日は何日?" .Move(30, 20, 80, 30) .AddClick(AddressOf(ButtonDate_Click)) .SendMessage(WM_SETFONT, wpHFontControl, 0) End With With buttonTime .Create(This) .Text = "今何時?" .Move(30, 60, 80, 30) .AddClick(AddressOf(ButtonTime_Click)) .SendMessage(WM_SETFONT, wpHFontControl, 0) End With End Sub Sub ButtonDate_Click(sender As Object, e As Args) MessageBox(This, ToTCStr(DateTime.Today.GetDateTimeFormats("yyyy/MM/dd")), "今日の日付", MB_OK) End Sub Sub ButtonTime_Click(sender As Object, e As Args) MessageBox(This, ToTCStr(DateTime.Now.GetDateTimeFormats("H:mm:ss")), "今日の日付", MB_OK) End Sub buttonDate As Button buttonTime As Button End Class Control.Initialize(GetModuleHandle(0)) Dim f = New DayTimeCheckForm f.Create() Application.Run(f)