| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 663 人关注过本帖
标题:msgbox窗口
只看楼主 加入收藏
wzff
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-1-24
收藏
 问题点数:0 回复次数:2 
msgbox窗口
msgbox窗口弹出后不按确定按钮,程序是否就不继续往下运行。如何才能在不按按钮,的情况下程序继续运行
搜索更多相关主题的帖子: msgbox 窗口 
2007-01-24 21:28
slore
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:1108
专家分:0
注 册:2005-7-1
收藏
得分:0 

griefforyou发过一个
'以下放到Moudle中

'**************************************
' Name: Auto close messagebox
' Description:This function replaces VB'
' s msgbox function and closes itself afte
' r the parameter provided number of secon
' ds. The syntax and return values are exa
' ctly the same as msgbox except the first
' parameter is the number of seconds to di
' splay. Just add this code to a module (n
' ot a cls or frm) in your project and cal
' l ACmsgbox. Thanks to Sparq's submission
' here for help in writing this.

'With the added parameter of
' By: Daniel Biener
'
'This code is copyrighted and has' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/vb/scripts/Sho
' wCode.asp?txtCodeId=27940&lngWId=1
'for details.

'**************************************

'**************************************
'Windows API/Global Declarations for :Au
' to close messagebox
'**************************************


Private Declare Function SetTimer Lib "user32" (Byval hWnd As Long, Byval nIDEvent As Long, Byval uElapse As Long, Byval lpTimerFunc As Long) As Long


Private Declare Function KillTimer Lib "user32" (Byval hWnd As Long, Byval nIDEvent As Long) As Long


Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (Byval lpClassName As String, Byval lpWindowName As String) As Long


Private Declare Function SetForegroundWindow Lib "user32" (Byval hWnd As Long) As Long
Private Const NV_CLOSEMSGBOX As Long = &H5000&
Private sLastTitle As String

Public Function ACmsgbox(AutoCloseSeconds As Long, prompt As String, Optional buttons As Long, _
Optional title As String, Optional helpfile As String, _
Optional context As Long) As Long
sLastTitle = title
SetTimer Screen.ActiveForm.hWnd, NV_CLOSEMSGBOX, AutoCloseSeconds * 1000, AddressOf TimerProc
ACmsgbox = Msgbox(prompt, buttons, title, helpfile, context)
End Function


Private Sub TimerProc(Byval hWnd As Long, Byval uMsg As Long, Byval idEvent As Long, Byval dwTime As Long)
Dim hMessageBox As Long
KillTimer hWnd, idEvent


Select Case idEvent
Case NV_CLOSEMSGBOX
hMessageBox = FindWindow("#32770", sLastTitle)


If hMessageBox Then
Call SetForegroundWindow(hMessageBox)
SendKeys "{enter}"
End If
sLastTitle = vbNullString
End Select
End Sub

'调用代码

Private Sub Command1_Click()
ACmsgbox 3, "test", vbYes, "test"
End Sub


快上课了……
2007-01-24 21:52
Kendy123456
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:62
帖 子:2720
专家分:0
注 册:2007-1-3
收藏
得分:0 
以下是引用wzff在2007-1-24 21:28:00的发言:
msgbox窗口弹出后不按确定按钮,程序是否就不继续往下运行。如何才能在不按按钮,的情况下程序继续运行

那这种时候你需要msgbox干什么呢


2007-01-25 10:52
快速回复:msgbox窗口
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020219 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved