- Timestamp:
- Jan 26, 2009, 1:53:37 AM (16 years ago)
- Location:
- trunk/ab5.0/ablib
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Control.ab
r674 r679 1 1 'Classes/ActiveBasic/Windows/UI/Control.ab 2 2 3 #require <Classes/ActiveBasic/Windows/UI/WindowHandle.ab> 3 4 #require <Classes/ActiveBasic/Windows/UI/EventArgs.ab> 4 5 #require <Classes/ActiveBasic/COM/ComClassBase.ab> -
trunk/ab5.0/ablib/src/Classes/ActiveBasic/Windows/UI/Timer.ab
r677 r679 1 2 #require <Classes/ActiveBasic/Windows/UI/Control.ab> 1 3 /* 2 4 @brief タイマ … … 10 12 Public 11 13 'Timer クラスの新しいインスタンスを初期化します。 12 Sub Timer() 13 Dim tc As TIMECAPS 14 timeGetDevCaps(tc,SizeOf(TIMECAPS)) 15 If 50 < tc.wPeriodMin Then 16 '今の時代にこんなPCはほとんどないだろうけど念のため 17 This.resolution = tc.wPeriodMin 18 Else 19 'Froms.Timerの精度は55msec前後 20 This.resolution = 50 21 End If 14 Sub Timer(control As Control) 15 If IsNothing(control) Then 16 Throw New System.ArgumentNullException("control") 17 EndIf 18 ctrl = control 22 19 End Sub 23 20 … … 25 22 Sub Enabled(value As Boolean) 26 23 If value Then 27 If This. id=0 Then This.Start()24 If This.handle=0 Then This.Start() 28 25 Else 29 If This. idThen This.Stop()26 If This.handle Then This.Stop() 30 27 End If 31 28 End Sub 32 29 Function Enabled() As Boolean 33 Return This.enabled30 Return handle <> 0 34 31 End Function 35 32 … … 52 49 'オーバーロードされます。 53 50 Sub Dispose() 54 This.Stop()51 killImpl() 55 52 End Sub 56 53 57 54 'タイマを起動します。 58 55 Sub Start() 59 This.id = timeSetEvent(This.interval,This.resolution,AddressOf(Detail.TimerProc_Impl),ObjPtr(This) As ULONG_PTR,TIME_PERIODIC or TIME_CALLBACK_FUNCTION) 60 If This.id Then This.enabled = True Else This.enabled = False 56 If handle = 0 Then 57 handle = AllocObjectHandle(This) 58 If SetTimer(ctrl As HWND, handle, interval, AddressOf(timerProc)) = 0 Then 59 ThrowWithLastError() 60 End If 61 End If 61 62 End Sub 62 63 63 64 'タイマを停止します。 64 65 Sub Stop() 65 timeKillEvent(This.id)66 This.id = 067 This.enabled = False66 If killImpl() = 0 Then 67 ThrowWithLastError() 68 End If 68 69 End Sub 69 70 … … 80 81 End Sub 81 82 82 Protected83 id As ULONG_PTR84 interval As Long85 resolution As DWord86 enabled As Boolean87 tag As Object88 89 83 Public 90 84 Sub AddTick(h As System.EventHandler) … … 100 94 End If 101 95 End Sub 96 Private 97 Static Sub timerProc(hwnd As HWND, msg As DWord, id As ULONG_PTR, time As DWord) 98 Dim timer = GetObjectFromHandle(id) As Timer 99 timer.OnTick(Nothing) 100 End Sub 101 102 Function killImpl() As Boolean 103 If handle <> 0 Then 104 killImpl = KillTimer(ctrl As HWND, handle) <> 0 105 ReleaseObjectHandle(handle) 106 handle = 0 107 End If 108 End Function 102 109 103 110 Tick As System.EventHandler 111 ctrl As Control 112 handle As LONG_PTR 'タイマ実行中のGC回避およびタイマIDとして使用 113 interval As DWord 104 114 End Class 105 106 107 Namespace Detail108 Class Timer_Impl109 Inherits Timer110 111 Public112 Sub OnTick()113 Super.OnTick(Nothing)114 End Sub115 End Class116 117 Sub TimerProc_Impl(uID As DWord, uMsg As DWord, dwUser As DWORD_PTR, dw1 As DWORD_PTR, dw2 As DWORD_PTR)118 Dim timer As Timer_Impl119 timer = dwUser As Timer_Impl120 timer.OnTick()121 End Sub122 123 End Namespace124 115 125 116 End Namespace 'UI -
trunk/ab5.0/ablib/src/api_gdi.sbp
r559 r679 788 788 789 789 Declare Function ExtSelectClipRgn Lib "gdi32" (hdc As HDC, hRgn As HRGN, fnMode As Long) As Long 790 Const ETO_OPAQUE = &h0002 791 Const ETO_CLIPPED = &h0004 792 '#if WINVER >= &h0400 793 Const ETO_GLYPH_INDEX = &h0010 794 Const ETO_RTLREADING = &h0080 795 Const ETO_NUMERICSLOCAL = &h0400 796 Const ETO_NUMERICSLATIN = &h0800 797 Const ETO_IGNORELANGUAGE = &h1000 798 '#endif 799 '#if _WIN32_WINNT >= &h0500 800 'Const ETO_PDY = &h2000 801 '#endif 802 '#if _WIN32_WINNT >= &h0600 803 'Const ETO_REVERSE_INDEX_MAP = &h10000 804 '#endif 790 805 Declare Function ExtTextOutA Lib "gdi32" (hdc As HDC, x As Long, y As Long, fuOptions As DWord, ByRef rc As RECT, lpString As PCSTR, cbCount As Long, pDx As *Long) As Long 791 806 Declare Function ExtTextOutW Lib "gdi32" (hdc As HDC, x As Long, y As Long, fuOptions As DWord, ByRef rc As RECT, lpString As PCWSTR, cbCount As Long, pDx As *Long) As Long
Note:
See TracChangeset
for help on using the changeset viewer.