易截截图软件、单文件、免安装、纯绿色、仅160KB

VB怎样判断、防止程序重复执行

Private Sub Form_load()
    '判断程序是否已经运行
    If App.PrevInstance
Then
     MsgBox "本程序已经运行!", vbInformation Or vbOKOnly, "提示信息"
     Unload
Me
     Exit Sub
    End If
    '以下是主要程序
    ' ……
    End
Sub
    附:另一个例子:
    Option Explicit
    Public Sub CheckExist(fm
As Form) '防止程序重复执行
      Dim title As String
      If App.PrevInstance
Then
      title = App.title
      Call MsgBox("这程序已执行",
vbCritical)
      App.title = "" '如此才不会 Avtivate 到自己
      fm.Caption =
""
      AppActivate title 'activate 先前就已运行的程序
      End ' 结束
      End
If
    End Sub
    Private Sub Form_Load()
     Call
CheckExist(Me)
    End Sub


相关文档:

vb实现网页自动填表

http://tieba.baidu.com/f?kz=580219489
http://www.anqn.com/vb/154/8974.shtml
http://www.codefans.net/soft/5089.shtml
http://www.mndsoft.com/blog/article.asp?id=1121
 http://topic.csdn.net/t/20020113/14/474848.html
直接运行网页中的JavaScript:
function alllefttab()
WebBrowser1.Document.par ......

VB文件粉碎机


'代码:
Option Explicit
'======================用于查找进程和终止进程的API函数常数定义================ =====
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function ProcessF ......

VB获取网卡MAC地址代码

Option Explicit
Private Const NCBASTAT = &H33
Private Const NCBNAMSZ = 16
Private Const HEAP_ZERO_MEMORY = &H8
Private Const HEAP_GENERATE_EXCEPTIONS = &H4
Private Const NCBRESET = &H32
Private Type NCB
ncb_command As Byte
ncb_retcode As Byte
ncb_lsn As Byte
ncb_num As Byte ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号