Questo il codice utilizzato con shellExecute (dai controlli fatti, il percorso di filePres risulta corretto)
codice:
Dim returnValue As Boolean
returnValue = My.Computer.FileSystem.FileExists(filePres)
If returnValue Then
On Error GoTo cmdOpenFile_Err
'open the document in whatever application it requires
ShellExecute(0, "open", filePres, vbNullString, vbNullString, vbNormalFocus)
cmdOpenFile_Err:
MsgBox("An unexpected error has occurred.", vbOKOnly + vbCritical, "Error Conditon in Opening File")
Else
MsgBox(filePres)
End If
L'errore che mi dà è:
PInvokeStackImbalance was detected etc etc
Questo il codice utilizzato con shell (dai controlli fatti, la procedura di richiamo dell'eseguibile, dà il percorso corretto)
codice:
Dim ProcID As Integer
filePres = Replace(filePres, " ", Chr(32))
Dim returnValue As Boolean
Dim strPercorso As String
strPercorso = Space$(MAX_FILENAME_LEN)
Call FindExecutable(filePres, vbNullChar, strPercorso)
returnValue = My.Computer.FileSystem.FileExists(filePres)
If returnValue Then
On Error GoTo cmdOpenFile_Err
'open the document in whatever application it requires
ProcID = Shell("" & strPercorso & " """ & filePres & """", AppWinStyle.NormalFocus)
AppActivate(ProcID)
cmdOpenFile_Err:
MsgBox("An unexpected error has occurred.", vbOKOnly + vbCritical, "Error Conditon in Opening File")
My.Computer.Keyboard.SendKeys(Keys.Right, True)
Else
MsgBox(filePres)
End If
Nessun messaggio di errore specifico