Ciao ho provato a fare come dici tu ma sul 98 continua a non funzionarmi ogni volta che estraggo il cd dal quale parte i programma mi viene fuori la schermata blu perchè manca il cD ma non mi dice il numero dell'errore.
qualcuno sa cosa fare???
codice:
Private Sub Timer3_Timer()
On Error GoTo Gest_err
Const Legge = "..\Leggimi.txt"
Const Filly = "SysLab.exe"
Dim PercorsoFile As String
Dim hSnapShot As Long
Dim uProcess As PROCESSENTRY32
Dim Esegui As Long
Dim ciao As Boolean
Dim num As Integer
ciao = False
hSnapShot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
If hSnapShot = 0 Then Exit Sub
uProcess.dwSize = Len(uProcess)
Esegui = ProcessFirst(hSnapShot, uProcess)
Do While Esegui
Label1.Caption = uProcess.szExeFile
num = InStr(1, Label1.Caption, Filly, vbTextCompare)
If num <> 0 Then ciao = True
Esegui = ProcessNext(hSnapShot, uProcess)
Loop
Call CloseHandle(hSnapShot)
PercorsoFile = App.Path
If Right(PercorsoFile, 1) <> "\" Then
PercorsoFile = PercorsoFile & "\"
End If
If Dir(PercorsoFile & Legge) = "" Then
Unload Me
Else
If ciao = False Then Shell PercorsoFile & Filly
End If
Exit Sub
Gest_err:
MsgBox "Error n° " & CStr(Err.Number) & vbCrLf & Err.Description, vbCritical, "Error"
Unload Me
End Sub