Ho un problema con un'applicativo VB6 che deve lanciare un secondo applicativo (con linea di comando) per alcune installazioni sul DB.Per lanciare il programma uso l'API CreateProcess:
codice:
Public Sub Esegui(AppName As String, CommandLine As String)
Dim pclass As Long
Dim aa As String
Dim sinfo As STARTUPINFO
Dim pinfo As PROCESS_INFORMATION
'Not used, but needed
Dim sec1 As SECURITY_ATTRIBUTES
Dim sec2 As SECURITY_ATTRIBUTES
CommandLine = " " & CommandLine
'Set the structure size
sec1.nLength = Len(sec1)
sec2.nLength = Len(sec2)
sinfo.cb = Len(sinfo)
'Set the flags
sinfo.dwFlags = STARTF_USESHOWWINDOW
'Set the window's startup position
sinfo.wShowWindow = start_size
'Set the priority class
pclass = Priority_Class
'Start the program
If CreateProcess(AppName, CommandLine, sec1, sec2, False, pclass, _
0&, vbNullString, sinfo, pinfo) Then
'Wait
WaitForSingleObject pinfo.hProcess, INFINITE
End If
End Sub
il programma poi apre il database ed esegue alcune query contenute in un file di testo. Su Win98 funziona tutto a dovere, mentre su WinXP da problemi sull'apertura del database, restituendemi l'errore n° -2147467259 "Errore non specificato" :master:
La cosa curiosa è che se eseguo il programma per conto suo con le gli stessi parametri passati dal primo, funziona tutto senza problemi.
Qualcuno a idee su cosa possa scatenarmi quell'errore?