mports System.IO.Stream
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Text
Public Class Form1
<DllImport("winmm.dll")> _
Private Shared Function mciSendString(ByVal strCommand As String, ByVal strReturn As StringBuilder, ByVal iReturnLength As Integer, ByVal hwndCallback As IntPtr) As Long
End Function
Private Declare Function ExitWindowsEx Lib "user32.dll" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Dim second As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
second = second - 1
Label1.Text = second & "초 후 종료"
If second = 0 Then
ExitWindowsEx(8, 0)
Timer1.Enabled = False
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
second = combobox1.Text
Timer1.Interval = 1000
Timer1.Enabled = True
Shell("shutdown -s")
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
second = second - 1
Label1.Text = second & "초 후 알림"
If second = 0 Then
Timer2.Enabled = False
mciSendString("open """ & "C:\Windows\Media\flourish.mid" & """ type mpegvideo alias MediaFile", Nothing, 0, IntPtr.Zero)
mciSendString("play MediaFile", Nothing, 0, IntPtr.Zero)
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Shell("shutdown -a")
mciSendString("stop MediaFile", Nothing, 0, IntPtr.Zero)
Timer1.Enabled = False
Timer2.Enabled = False
Label1.Text = "정지"
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
second = ComboBox1.Text
Timer2.Interval = 1000
Timer2.Enabled = True
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub ComboBox1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyUp
If e.KeyCode = Keys.Enter Then
Button3_Click(sender, e)
End If
End Sub
End Class
'프로그래밍언어 > VB.NET' 카테고리의 다른 글
2013년 1월 24일 오전 06:21 (0) | 2013.01.24 |
---|---|
MNET정규식연습 (0) | 2013.01.24 |
VB6 -> C# 포팅, 네이버 로그인, 네이버 쪽지 전송, 네이버 메일 전송 (0) | 2013.01.24 |
VB.NET에서 엑셀 Application객체사용법 (0) | 2013.01.24 |
2013년 1월 19일 오전 01:48 (0) | 2013.01.19 |