' TODO: この位置にグローバルな変数、構造体、定数、関数を定義します。 Dim g_counter As DWord Const ID_TIMER01 = 01
Sub TimerIsOut() Dim hdc As HDC Dim hbr As HBRUSH, hobr As HBRUSH Dim hpn As HPEN, hopn As HPEN hdc = GetDC(hMainWnd) hbr = GetStockObject(DKGRAY_BRUSH) hobr = SelectObject(hdc,hbr) hpn = GetStockObject(WHITE_PEN) hopn = SelectObject(hdc,hpn) RoundRect(hdc,0,0,444,333,15,15) TextOut(hdc,100,50,"時間", 4) SelectObject(hdc,hopn) SelectObject(hdc,hobr) ReleaseDC(hMainWnd, hdc) End Sub
Sub MainWnd_Destroy() HiraiRamenTimar_DestroyObjects() PostQuitMessage(0) End Sub
Sub MainWnd_CommandButton1_Click() Dim sss[555] As Byte 'エデットボックスから数字を獲得 GetWindowText(GetDlgItem(hMainWnd,EditBox1), sss, 555) g_counter = Val(sss) * 60'秒に変更 SendMessage(GetDlgItem(hMainWnd, ProgressBar1), PBM_SETRANGE32,0, g_counter) SendMessage(GetDlgItem(hMainWnd, ProgressBar1), PBM_SETPOS,0, 0) SendMessage(GetDlgItem(hMainWnd, ProgressBar1), PBM_SETSTEP,1, 0) SetTimer(hMainWnd, ID_TIMER01, 1000,NULL) End Sub
Sub MainWnd_Timer(TimerID As DWord) Select Case TimerID Case ID_TIMER01 g_counter = g_counter-1 SendMessage(GetDlgItem(hMainWnd, ProgressBar1), PBM_STEPIT,0, 0) If g_counter = 0 Then '時間切れ TimerIsOut() KillTimer(hMainWnd, TimerID) End If End Select End Sub