Private Sub Command1_Click() Shell "平抛运动的演示.exe", 1 End SubPrivate Sub Command2_Click() On Error GoTo 100 Open "平抛运动的演示.exe" For Append As #1 ' Print #1, "" Close 1 Exit Sub 100 MsgBox "程序已经运行!" End Sub Private Sub Command3_Click() On Error GoTo 100 Name "平抛运动的演示.exe" As "temp.temp" Name "temp.temp" As "平抛运动的演示.exe" Exit Sub 100 MsgBox "程序已经运行!" End Sub 回复人:xxlroad(xxlroad) (2001-6-28 15:32:56) Private Sub Command1_Click() Open "aa.txt" For Append As #1 Print #1, "sadgfsdfsd" End SubPrivate Sub Command2_Click() Close End SubPrivate Sub Command3_Click() Name "aa.txt" As "bb.txt" End Sub
If App.PrevInstance Then msg = App.EXEName & "has already run" MsgBox msg, vbExclamation, "Warning" End End If
当然包括以运行了多少个副本咯
呵呵,不好意思,我没有专业精神,对不起!
On Error GoTo 100
Name "aa.dat" As "temp.temp"
Name "temp.temp" As "aa.dat"
Exit Sub
100
MsgBox "Opend"
End Sub
对付可执行文件当然高,对付txt文件可就不高了
你试试看,用记事本打开一个txt文件,然后再资源管理器里面修改文件名,看看报不报错:)
Shell "平抛运动的演示.exe", 1
End SubPrivate Sub Command2_Click()
On Error GoTo 100
Open "平抛运动的演示.exe" For Append As #1
' Print #1, ""
Close 1
Exit Sub
100
MsgBox "程序已经运行!"
End Sub Private Sub Command3_Click()
On Error GoTo 100
Name "平抛运动的演示.exe" As "temp.temp"
Name "temp.temp" As "平抛运动的演示.exe"
Exit Sub
100
MsgBox "程序已经运行!"
End Sub 回复人:xxlroad(xxlroad) (2001-6-28 15:32:56)
Private Sub Command1_Click()
Open "aa.txt" For Append As #1
Print #1, "sadgfsdfsd"
End SubPrivate Sub Command2_Click()
Close
End SubPrivate Sub Command3_Click()
Name "aa.txt" As "bb.txt"
End Sub
msg = App.EXEName & "has already run"
MsgBox msg, vbExclamation, "Warning"
End
End If