1 | /*!
|
---|
2 | @file
|
---|
3 | @brief 「Win32プログラミング講座 ~ Step5. ボタン コントロールを使う ~」のAB5移植版
|
---|
4 | http://www.activebasic.com/help_center/articles/win32/step05/
|
---|
5 |
|
---|
6 | @date 2008/07/20
|
---|
7 | @auther Egtra
|
---|
8 | */
|
---|
9 |
|
---|
10 | #require <Classes/ActiveBasic/Windows/UI/Form.ab>
|
---|
11 | #require <Classes/ActiveBasic/Windows/UI/Application.ab>
|
---|
12 | #require <Classes/ActiveBasic/Windows/UI/Button.ab>
|
---|
13 | #require <Classes/ActiveBasic/Windows/UI/TaskMsg.ab>
|
---|
14 |
|
---|
15 | Imports ActiveBasic.Windows.UI
|
---|
16 | Imports System
|
---|
17 |
|
---|
18 | #resource "UI_Sample.rc"
|
---|
19 |
|
---|
20 | Class DayTimeCheckForm
|
---|
21 | Inherits Form
|
---|
22 | Public
|
---|
23 | Sub DayTimeCheckForm()
|
---|
24 | AddCreate(AddressOf(OnCreate))
|
---|
25 | End Sub
|
---|
26 |
|
---|
27 | Protected
|
---|
28 | Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
|
---|
29 | Super.GetCreateStruct(cs)
|
---|
30 | With cs
|
---|
31 | .style = WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_DLGFRAME Or WS_MINIMIZEBOX
|
---|
32 | .cx = 140
|
---|
33 | .cy = 130
|
---|
34 | End With
|
---|
35 | End Sub
|
---|
36 |
|
---|
37 | Private
|
---|
38 | Sub OnCreate(sender As Object, e As CreateArgs)
|
---|
39 | buttonDate = New Button
|
---|
40 | buttonTime = New Button
|
---|
41 | Dim wpHFontControl = GetStockObject(DEFAULT_GUI_FONT) As WPARAM
|
---|
42 | With buttonDate
|
---|
43 | .Create(This)
|
---|
44 | .Text = "今日は何日?"
|
---|
45 | .Move(30, 20, 80, 30)
|
---|
46 | .AddClick(AddressOf(ButtonDate_Click))
|
---|
47 | .SendMessage(WM_SETFONT, wpHFontControl, 0)
|
---|
48 | End With
|
---|
49 |
|
---|
50 | With buttonTime
|
---|
51 | .Create(This)
|
---|
52 | .Text = "今何時?"
|
---|
53 | .Move(30, 60, 80, 30)
|
---|
54 | .AddClick(AddressOf(ButtonTime_Click))
|
---|
55 | .SendMessage(WM_SETFONT, wpHFontControl, 0)
|
---|
56 | End With
|
---|
57 | End Sub
|
---|
58 |
|
---|
59 | Sub ButtonDate_Click(sender As Object, e As Args)
|
---|
60 | TaskMsg(This, "今日の日付", DateTime.Today.GetDateTimeFormats("yyyy/MM/dd"), Nothing, MB_OK)
|
---|
61 | End Sub
|
---|
62 |
|
---|
63 | Sub ButtonTime_Click(sender As Object, e As Args)
|
---|
64 | TaskMsg(This, "現在時刻", DateTime.Now.GetDateTimeFormats("H:mm:ss"), Nothing, MB_OK)
|
---|
65 | End Sub
|
---|
66 |
|
---|
67 | buttonDate As Button
|
---|
68 | buttonTime As Button
|
---|
69 | End Class
|
---|
70 |
|
---|
71 | Control.Initialize(GetModuleHandle(0))
|
---|
72 | Dim f = New DayTimeCheckForm
|
---|
73 | f.CreateForm()
|
---|
74 | Application.Run(f)
|
---|