如何让程序在第一次运行时执行一个外部文件。就让这个文件只运行一次例如:第一次打开一个程序,让这个程序在打开的同时再执行一个外部文件
当第二次打开这个程序时就不再执行这个外部文件了。而是直接打开这个程序。

解决方案 »

  1.   

    写个专用过程来执行这个外部文件:一,判断是否有目标文件:二,有,则执行,执行完了后删除;三,无,跳过.如果不可删除,那么就需要把"已经运行过了"的标志写在某处;注册表比较方便,尝试使用getsetting/savesetting函数完成.
      

  2.   

    能否提供代码.谢了
    [email protected]
      

  3.   

    Private Sub Form_Load()
    Dim Bool As Boolean
    Bool = FileExist(App.Path * "\123.exe")
    If Bool = False Then GoTo Line
    Shell App.Path * "\123.exe"
    Line:
    End SubPrivate Sub Form_Unload(Cancel As Integer)
    Kill App.Path * "\123.exe"
    End Sub
    Private Function FileExist(vFile As String) As Boolean '判断文件是否存在
        On Error Resume Next
        FileExist = False
        If Dir$(vFile) <> "" Then: FileExist = True
    End Function
      

  4.   

    写个配置文件好些,不然系统重新安装了,软件重新运行有时是可怕的具体可以搜索下 VB ini
      

  5.   

    用API查找外部程序的进程是否存在,如果不存在就运行它,存在就不再运行它