English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

我想要一個簡單的VB鬧鐘程式
誰能幫幫忙呢!
幫幫幫~~
就是一個能自己設定鬧鐘時間
時間到能做其一件事情
如有聲音~會一直閃爍等等

2007-02-16 08:22:36 · 4 個解答 · 發問者 糖果 1 in 電腦與網際網路 程式設計

4 個解答

Rem 表單佈局:
Rem image*1,command_button*3,frame*3,Timer*2,OLE*1
Rem frame各放置text *3 及確定按鈕, 可分別設定鬧鐘時間,調整系統時間、顯示鬧鈴時間,確定後儲存至變數等待時間比對。

Dim frm_show As Boolean
Dim alarm As Boolean
Dim alarm_hh, alarm_mm, alarm_ss As Integer

Private Sub cmd_end_display_Click()
Call disable_frame
End Sub

Private Sub cmd_end_modify_Click()
hh = Text4
mm = Text5
ss = Text6
set_time = hh & ":" & mm & ":" & ss
Time = set_time '設定系統時間

Call disable_frame
End Sub

Private Sub cmd_end_set_Click() '設定鬧鈴時間
alarm_hh = Val(Text1)
alarm_mm = Val(Text2)
alarm_ss = Val(Text3)

Call disable_frame
End Sub

Private Sub Command_display_Click() '鬧鈴顯示
Frame_modify.Visible = False
Frame_set.Visible = False
Frame_display.Visible = True

Text7 = alarm_hh
Text8 = alarm_mm
Text9 = alarm_ss
End Sub

Private Sub Command_modify_Click() '時鐘調整

Frame_modify.Visible = True
Frame_set.Visible = False

Text4 = Hour(Time) '截取現在系統時間
Text5 = Minute(Time)
Text6 = Second(Time)

End Sub

Private Sub Command_set_Click() '鬧鈴設定
Frame_modify.Visible = False
Frame_display.Visible = False
Frame_set.Visible = True

hh = Hour(Time) '預設值為現在系統時間
mm = Minute(Time)
ss = Second(Time)
Text1 = hh
Text2 = mm
Text3 = ss

End Sub

Rem image1上方製作2個command_button,下方為button1,上方為button2
Private Sub Command1_Click() '當作鬧鐘上方的控制鍵,按一下,則command2顯示
Command2.Visible = Not Command2.Visible
If Command2.Visible = True Then
alarm = True
Else
alarm = False
OLE1.Close
End If
End Sub

Private Sub Command2_Click() '當作鬧鐘上方的控制鍵,按下時停止鬧鈴
Command2.Visible = Not Command2.Visible
If Command2.Visible = True Then
alarm = True
Else
alarm = False
OLE1.Close
End If
End Sub
以上顯示有亂碼部份,'是註解符號(單引號),"是雙引號的亂碼
內容太多,待續…

2007-02-21 22:25:53 補充:
Private Sub Form_Load()
Call disable_frame
Label1 = Date
alarm = False
Timer2.Enabled = False
End Sub
內容待續

2007-02-21 22:26:38 補充:
Private Sub Image1_Click() '可以用繪圖軟體畫個鬧鐘
frm_show = Not frm_show
If frm_show = True Then
Command_set.Visible = True
Command_modify.Visible = True
Command_display.Visible = True
Else
Call disable_frame
End If
End Sub
內容待續

2007-02-21 22:28:13 補充:
Private Sub Timer1_Timer() '系統時間
hh = Hour(Time)
mm = Minute(Time)
ss = Second(Time)
Label2 = "現在時間:" & hh & "點" & mm & "分" & ss & "秒"
'---------------------------------------------------------
If alarm_hh = hh And alarm_mm = mm And alarm_ss = ss Then
alarm = True

2007-02-21 22:29:06 補充:
Timer2.Enabled = True

End If
If alarm_mm = mm Then
Timer2.Enabled = True
Else
Timer2.Enabled = False
End If
End Sub

2007-02-21 22:30:20 補充:
Sub disable_frame()
Command_set.Visible = False
Command_modify.Visible = False
Command_display.Visible = False
'--------------------------------
Frame_modify.Visible = False
Frame_display.Visible = False
Frame_set.Visible = False
End Sub

2007-02-21 22:30:30 補充:
Private Sub Timer2_Timer() '控制鬧鈴音樂動作
If alarm Then
OLE1.DoVerb 'ole1控制項,負責播放音樂(wav)
End If
End Sub

2007-02-21 17:12:01 · answer #1 · answered by ? 5 · 0 0

到下面的網址看看吧

▶▶http://qoozoo201409150.pixnet.net/blog

2014-09-20 17:40:46 · answer #2 · answered by Anonymous · 0 0

這有類似的

▶▶http://qoozoo1400703.pixnet.net/blog

2014-08-17 15:17:10 · answer #3 · answered by Anonymous · 0 0

給一個 基本的 你自己再去改吧 (VB6)
螢幕上的配置:
標記1: "現在時間"
標記2: "鬧鐘時間"
文字框1: (Text1)
文字框2: (Text2) --- 輸入 鬧鐘時間
按鈕1: (Command1) "Start"
按鈕2: (Command2) "Exit"
時鐘1: (Timer1) --- Interval 設為 1000
=================================
Option Explicit
Dim start As Integer
Private Sub Command1_Click()
start = 1
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
start = 0
End Sub
Private Sub Timer1_Timer()
Text1.Text = Format(Time, "hh:mm:ss")
If (start = 1) Then
If (Text1.Text > Text2.Text) Then
Beep
End If
End If
End Sub
=================================
鬧鐘時間 請依 "hh:mm:ss" 的格式輸入
時間到了電腦會一直 嗶嗶 叫
直到你按 Exit
如果有問題, 請來函討論. 不然, 我可能會錯失你再補充的疑點.

2007-02-19 00:38:00 · answer #4 · answered by JJ 7 · 0 0

fedest.com, questions and answers