Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
App. Visual Studio 6.0
Comando shell in vb6
giovedì 03 luglio 2008 - 08.41
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
willy_80
Profilo
| Senior Member
255
messaggi | Data Invio:
gio 3 lug 2008 - 08:41
Ciao a tutti,
Ho fatto tre applicazioni in vb2005 per dei pc industriali, chiaramente per far girare queste applicazioni è necessario anche il framewark.
Ho notato che se creo un eseguibile in vb6 quello gira senza problemi.
Ho quindi deciso di creare un programmino in vb6 che contiene 4 Button, all'evento click di ciascuno col comando shell lancio uno dei 4 eseguibili compreso il framewark, tutto funziona correttamente.
La mia domanda è:
Quando avvio uno dei setup col comando shell vorrei che la mia applicazione in vb6 rimanesse inattiva o bloccata o ridotta ad icona finchè il setup non ha finito l'installazione, è possibile ? , come si fa ?
Grazie a tutti quelli che risponderanno.
luigidibiasi
Profilo
| Guru
1.077
messaggi | Data Invio:
gio 3 lug 2008 - 10:16
Codice trovato in rete:
Option Explicit
Private Const kstrModuleName = "modShell"
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessID As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Sub ShellAndWait(ByVal strCommand As String, Optional ExecMode As VbAppWinStyle = vbMinimizedNoFocus)
On Error GoTo ProcedureError
Const kstrProcedureName = "ShellAndWait"
Dim ProcessID As Long
Dim hProcess As Long
Dim hWnd As Long
Dim ret As Long
'start the process
ProcessID = Shell(strCommand, CLng(ExecMode))
'wait for the process to finish
hProcess = OpenProcess(&H100000, False, ProcessID)
ret = WaitForSingleObject(hProcess, -1&)
'close the process handle
CloseHandle hProcess
ProcedureExit:
On Error Resume Next
Exit Sub
ProcedureError:
'need to re-raise the error to the calling procedure in the appropriate format
Select Case Err.Number
Case Else 'exception raised in code
Err.Raise Err.Number, Err.Source, Err.Description
End Select
Resume ProcedureExit
Resume
End Sub
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !