728x90
728x170
▶ Module
Public Const NV_CLOSEMSGBOX As Long = &H5000&
Public MessageTitle As String
Declare Function SetForegroundWindow Lib "user32" (ByVal pWindowHandle As Long) As Long
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal strClassName As String, ByVal strWindowName As String) As Long
Declare Function SetTimer Lib "user32" (ByVal pWindowHandle As Long, ByVal lIDEvent As Long, ByVal lElapse As Long, ByVal lTimerFunction As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal pWindowHandle As Long, ByVal lIDEvent As Long) As Long
Public Sub TimerProcedure(ByVal pWindowHandle As Long, ByVal lMessage As Long, ByVal lIDEvent As Long, ByVal lTime As Long)
Dim lMessageBoxHandle As Long
KillTimer pWindowHandle, lIDEvent
lMessageBoxHandle = FindWindow("#32770", MessageTitle)
If lMessageBoxHandle Then
Call SetForegroundWindow(lMessageBoxHandle)
SendKeys "{enter}"
End If
End Sub
728x90
▶ Form
Private Sub Command1_Click()
Dim pWindowHandle As Long
SetTimer pWindowHandle, NV_CLOSEMSGBOX, 3000, AddressOf TimerProcedure
MessageTitle = "메세지박스 자동 종료"
MsgBox "3초후 메세지박스가 종료됩니다", vbInformation, MessageTitle
End Sub
728x90
그리드형(광고전용)
'VB' 카테고리의 다른 글
[VB] SQL Server 연결 구하기 (0) | 2015.05.16 |
---|---|
[VB] UBOUND 함수를 사용해 배열 상한 인덱스 구하기 (0) | 2015.05.16 |
[VB] 법인등록번호 검증하기 (0) | 2015.05.16 |
[VB] 폼 배경에 바탕 화면 이미지 보여주기 (0) | 2015.05.16 |
[VB] 단축 아이콘 만들기 (0) | 2015.05.16 |
[VB] ComboBox 클래스 : 포커스 획득시 드롭 다운 리스트 자동으로 보여주기 (0) | 2015.05.16 |
[VB] 비프음 연주하기 (0) | 2015.05.16 |
[VB] CHR 함수 사용하기 (0) | 2015.05.16 |
[VB] JOIN 함수 사용하기 (0) | 2015.05.16 |
[VB] 제곱 값 구하기 (0) | 2015.05.16 |