「分>0 And 秒<0」の時のコーディングは出来たのですが、
「時間>0 And 分<0 And 秒<0」と「時間<0 And 分<0 And 秒<0」が出来ません。
いろいろやってみましたが、どれも失敗するので質問することにしました。
分>0 And 秒<0 と 分<0 And 秒<0 のコード [ここをクリックすると内容が表示されます]
コードは参考までコード: 全て選択
dim hh as HWND, mm as HWND, ss as HWND
dim cntH as HWND, cntM as HWND, cntS as HWND
dim bt as HWND, bar as HWND
dim buf_h as long, buf_m as long, buf_s as long
dim count as long
Declare Function GetDlgItemInt Lib "user32.dll" (hDlg As HWND,nIDDlgItem As Long,lpTranslated As DWordPtr,bSinged As Long) As Long
' -----------------------------------------------------------------------------------------------------------------------------
Sub MainWnd_Create(ByRef CreateStruct As CREATESTRUCT)
hh=GetDlgItem(hMainWnd,HourBox)
mm=GetDlgItem(hMainWnd,MinBox)
ss=GetDlgItem(hMainWnd,SecBox)
bt=GetDlgItem(hMainWnd,StartButton)
cntH=GetDlgItem(hMainWnd,Static_CountH)
cntM=GetDlgItem(hMainWnd,Static_CountM)
cntS=GetDlgItem(hMainWnd,Static_CountS)
bar=GetDlgItem(hMainWnd,ProgressBar1)
bt=GetDlgItem(hMainWnd,StartButton)
End Sub
Sub MainWnd_StartButton_Click()
dim buf as String
dim h as String, m as String
dim length as String
buf_h=GetDlgItemInt(hMainWnd,HourBox,0,1)
buf_m=GetDlgItemInt(hMainWnd,MinBox,0,1)
buf_s=GetDlgItemInt(hMainWnd,SecBox,0,1)
buf=Str$(buf_h*360+buf_m*60+buf_s)
count=Val(buf)
if count<=0 then exit sub
EnableWindow(hh,0)
EnableWindow(mm,0)
EnableWindow(ss,0)
EnableWindow(bt,0)
SetWindowText(cntS,Str$(buf_s)+" 秒")
SetWindowText(cntH,Str$(buf_h)+" 時間")
SetWindowText(cntM,Str$(buf_m)+" 分")
SetTimer(hMainWnd,0,1000,0)
End Sub
Sub MainWnd_Timer(TimerID As DWord)
count=count-1
SendMessage(bar,PBM_STEPIT,0,0)
buf_s=buf_s-1
if count then
SetWindowText(cntS,Str$(buf_s)+" 秒")
if buf_s<0 and buf_m>0then
buf_s=59
SetWindowText(cntS,Str$(buf_s)+" 秒")
buf_m=buf_m-1
SetWindowText(cntM,Str$(buf_m)+" 分")
exit sub
end if
exit sub
End If
KillTimer(hMainWnd,0)
End Sub
よろしくお願いします。