'프로젝트에서 모듈을 추가한다.

'아래 코드를 모듈에 입력한다.

 

Public Const NV_CLOSEMSGBOX As Long = &H5000&

Public Declare Function SetTimer& Lib "user32" (ByVal hWnd&, ByVal nIDEvent&, _

ByVal uElapse&, ByVal lpTimerFunc&)

Public Declare Function FindWindow& Lib "user32" Alias "FindWindowA" _

(ByVal lpClassName$, ByVal lpWindowName$)

Public Declare Function LockWindowUpdate& Lib "user32" (ByVal hwndLock&)

Public Declare Function SetForegroundWindow& Lib "user32" (ByVal hWnd&)

Public Declare Function MessageBox& Lib "user32" Alias "MessageBoxA" _

(ByVal hWnd&, ByVal lpText$, ByVal lpCaption$, ByVal wType&)

Public Declare Function KillTimer& Lib "user32" (ByVal hWnd&, ByVal nIDEvent&)

Public Const API_FALSE As Long = 0&

Public Sub TimerProc(ByVal hWnd&, ByVal uMsg&, ByVal idEvent&, ByVal dwTime&)

KillTimer hWnd, idEvent

Dim hMessageBox&

'Replace 'Self Closing Message Box' with the title you gave to your message box.

hMessageBox = FindWindow("#32770", "Self Closing Message Box")

If hMessageBox Then

Call SetForegroundWindow(hMessageBox)

SendKeys "{enter}"

End If

Call LockWindowUpdate(API_FALSE)

End Sub

 

'해당하는 폼에 아래코드를 입력한다.

 

Private Sub Form_Load()

'Replace the '4000' below with the number of milliseconds the message box

'will appear. 1000 milliseconds = 1 second

SetTimer hWnd, NV_CLOSEMSGBOX, 4000&, AddressOf TimerProc

Call MessageBox(hWnd, "Watch this message box close itself after four seconds", _

"Self Closing Message Box", MB_ICONQUESTION Or MB_TASKMODAL)

End Sub


'Tech: > ASP·VB6' 카테고리의 다른 글

VB-SystemMonitor 사용하기  (0) 2008.06.26
Window2000에서의 MSMQ 사용  (0) 2008.06.26
VB 속도향상 팁 45가지  (0) 2008.06.26
VB-IBM MQSeries 사용법  (0) 2008.06.26
MTS와 COM+에서의 Transaction  (0) 2008.06.26


Posted by 떼르미
,


자바스크립트를 허용해주세요!
Please Enable JavaScript![ Enable JavaScript ]