Voici un bout de code.
J'aimerais savoir pourquoi mon Acrobat.exe reste ouvert dans mes processus ?
et comment le fermer
Merci
Marc
Dim AcroExchApp As Acrobat.CAcroApp
Dim AcroExchPDDoc As Acrobat.CAcroAVDocDim AcroExchInsertPDDoc As
Acrobat.CAcroPDDoc
Dim AcroExchInsertPDDoc2 As Acrobat.CAcroPDDoc
Dim strFileName As String ', strPath As String
Dim iNumberOfPagesToInsert As Long
Dim iLastPage As Long
Set AcroExchApp = CreateObject("AcroExch.App")
Set AcroExchPDDoc = CreateObject("AcroExch.AvDoc")
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
LE TROLL
Bonjour,
Je ne sais pas si ça va t'être utile, mais voici un code testé qui peut depuis l'application, ouvrir et fermer Acrobate, par contre pour le fichier je n'y arrive pas ("pathprogramme.exe " & "pathnomfichier.pdf", 1) --------------------------
' lance acrobate : form 1 ' Option Explicit ' Private Declare Function OpenProcess Lib "kernel32" ( _ ByVal dwDesiredAccess As Long, _ ByVal bInheritHandle As Long, _ ByVal dwProcessId As Long _ ) As Long ' Private Declare Function TerminateProcess Lib "kernel32" ( _ ByVal hProcess As Long, _ ByVal uExitCode As Long _ ) As Long Private Declare Function CloseHandle Lib "kernel32" ( _ ByVal hObject As Long) As Long ' Private Const PROCESS_TERMINATE = &H1 Dim NumProcess As Long Dim RC As Long Dim hProcess As Long '
Sub Command1_Click() ' lance On Error GoTo erreur NumProcess = Shell("C:Program FilesAdobeReader 8.0ReaderAcroRd32.exe ", 1) Exit Sub ' erreur: MsgBox Err End Sub
Sub Command2_Click() ' ferme hProcess = OpenProcess(PROCESS_TERMINATE, -1&, NumProcess) RC = TerminateProcess(hProcess, 0&) RC = CloseHandle(hProcess) End Sub
-- Romans, logiciels, email, site personnel http://irolog.free.fr/joe.htm ------------------------------------------------------------------------------------ "Marc Sylvain" a écrit dans le message de news: %23gl$ | Voici un bout de code. | J'aimerais savoir pourquoi mon Acrobat.exe reste ouvert dans mes processus ? | et comment le fermer | | Merci | Marc | | | Dim AcroExchApp As Acrobat.CAcroApp | Dim AcroExchPDDoc As Acrobat.CAcroAVDocDim AcroExchInsertPDDoc As | Acrobat.CAcroPDDoc | Dim AcroExchInsertPDDoc2 As Acrobat.CAcroPDDoc | Dim strFileName As String ', strPath As String | Dim iNumberOfPagesToInsert As Long | Dim iLastPage As Long | | Set AcroExchApp = CreateObject("AcroExch.App") | Set AcroExchPDDoc = CreateObject("AcroExch.AvDoc") | | | AcroExchApp.Show | Call AcroExchPDDoc.Open(Fichier_Depart, "") | Set AcroExchInsertPDDoc = AcroExchPDDoc.GetPDDoc | Cont_file = 0 | While Fichier_Insert(Cont_file) <> "" | iLastPage = AcroExchInsertPDDoc.GetNumPages - 1 | Set AcroExchInsertPDDoc2 = CreateObject("AcroExch.PDDoc") | AcroExchInsertPDDoc2.Open (Fichier_Insert(Cont_file)) | iNumberOfPagesToInsert = AcroExchInsertPDDoc2.GetNumPages | AcroExchInsertPDDoc.InsertPages iLastPage, AcroExchInsertPDDoc2, 0, | iNumberOfPagesToInsert, True | AcroExchInsertPDDoc2.Close | Kill Fichier_Insert(Cont_file) | Cont_file = Cont_file + 1 | Wend | AcroExchInsertPDDoc.Save 1, "C:JOB_PDF" & Left(MyDoc.Name, | Len(MyDoc.Name) - 4) & ".Pdf" | AcroExchInsertPDDoc.Close | AcroExchApp.Exit | Kill Fichier_Depart | Set AcroExchInsertPDDoc = Nothing | Set AcroExchInsertPDDoc2 = Nothing | Set AcroExchPDDoc = Nothing | Set AcroExchApp = Nothing | | |
Bonjour,
Je ne sais pas si ça va t'être utile, mais
voici un code testé qui peut depuis l'application,
ouvrir et fermer Acrobate, par contre pour le
fichier je n'y arrive pas
("pathprogramme.exe " & "pathnomfichier.pdf", 1)
--------------------------
' lance acrobate : form 1
'
Option Explicit
'
Private Declare Function OpenProcess Lib
"kernel32" ( _
ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long _
) As Long
'
Private Declare Function TerminateProcess Lib
"kernel32" ( _
ByVal hProcess As Long, _
ByVal uExitCode As Long _
) As Long
Private Declare Function CloseHandle Lib
"kernel32" ( _
ByVal hObject As Long) As Long
'
Private Const PROCESS_TERMINATE = &H1
Dim NumProcess As Long
Dim RC As Long
Dim hProcess As Long
'
Sub Command1_Click() ' lance
On Error GoTo erreur
NumProcess = Shell("C:Program
FilesAdobeReader 8.0ReaderAcroRd32.exe ", 1)
Exit Sub
'
erreur:
MsgBox Err
End Sub
Sub Command2_Click() ' ferme
hProcess = OpenProcess(PROCESS_TERMINATE, -1&,
NumProcess)
RC = TerminateProcess(hProcess, 0&)
RC = CloseHandle(hProcess)
End Sub
--
Romans, logiciels, email, site personnel
http://irolog.free.fr/joe.htm
------------------------------------------------------------------------------------
"Marc Sylvain" <marc.sylvain@manac.ca> a écrit
dans le message de news:
%23gl$SMc2HHA.1100@TK2MSFTNGP06.phx.gbl...
| Voici un bout de code.
| J'aimerais savoir pourquoi mon Acrobat.exe reste
ouvert dans mes processus ?
| et comment le fermer
|
| Merci
| Marc
|
|
| Dim AcroExchApp As Acrobat.CAcroApp
| Dim AcroExchPDDoc As Acrobat.CAcroAVDocDim
AcroExchInsertPDDoc As
| Acrobat.CAcroPDDoc
| Dim AcroExchInsertPDDoc2 As Acrobat.CAcroPDDoc
| Dim strFileName As String ', strPath As String
| Dim iNumberOfPagesToInsert As Long
| Dim iLastPage As Long
|
| Set AcroExchApp = CreateObject("AcroExch.App")
| Set AcroExchPDDoc =
CreateObject("AcroExch.AvDoc")
|
|
| AcroExchApp.Show
| Call AcroExchPDDoc.Open(Fichier_Depart, "")
| Set AcroExchInsertPDDoc = AcroExchPDDoc.GetPDDoc
| Cont_file = 0
| While Fichier_Insert(Cont_file) <> ""
| iLastPage = AcroExchInsertPDDoc.GetNumPages -
1
| Set AcroExchInsertPDDoc2 =
CreateObject("AcroExch.PDDoc")
| AcroExchInsertPDDoc2.Open
(Fichier_Insert(Cont_file))
| iNumberOfPagesToInsert =
AcroExchInsertPDDoc2.GetNumPages
| AcroExchInsertPDDoc.InsertPages iLastPage,
AcroExchInsertPDDoc2, 0,
| iNumberOfPagesToInsert, True
| AcroExchInsertPDDoc2.Close
| Kill Fichier_Insert(Cont_file)
| Cont_file = Cont_file + 1
| Wend
| AcroExchInsertPDDoc.Save 1, "C:JOB_PDF" &
Left(MyDoc.Name,
| Len(MyDoc.Name) - 4) & ".Pdf"
| AcroExchInsertPDDoc.Close
| AcroExchApp.Exit
| Kill Fichier_Depart
| Set AcroExchInsertPDDoc = Nothing
| Set AcroExchInsertPDDoc2 = Nothing
| Set AcroExchPDDoc = Nothing
| Set AcroExchApp = Nothing
|
|
|
Je ne sais pas si ça va t'être utile, mais voici un code testé qui peut depuis l'application, ouvrir et fermer Acrobate, par contre pour le fichier je n'y arrive pas ("pathprogramme.exe " & "pathnomfichier.pdf", 1) --------------------------
' lance acrobate : form 1 ' Option Explicit ' Private Declare Function OpenProcess Lib "kernel32" ( _ ByVal dwDesiredAccess As Long, _ ByVal bInheritHandle As Long, _ ByVal dwProcessId As Long _ ) As Long ' Private Declare Function TerminateProcess Lib "kernel32" ( _ ByVal hProcess As Long, _ ByVal uExitCode As Long _ ) As Long Private Declare Function CloseHandle Lib "kernel32" ( _ ByVal hObject As Long) As Long ' Private Const PROCESS_TERMINATE = &H1 Dim NumProcess As Long Dim RC As Long Dim hProcess As Long '
Sub Command1_Click() ' lance On Error GoTo erreur NumProcess = Shell("C:Program FilesAdobeReader 8.0ReaderAcroRd32.exe ", 1) Exit Sub ' erreur: MsgBox Err End Sub
Sub Command2_Click() ' ferme hProcess = OpenProcess(PROCESS_TERMINATE, -1&, NumProcess) RC = TerminateProcess(hProcess, 0&) RC = CloseHandle(hProcess) End Sub
-- Romans, logiciels, email, site personnel http://irolog.free.fr/joe.htm ------------------------------------------------------------------------------------ "Marc Sylvain" a écrit dans le message de news: %23gl$ | Voici un bout de code. | J'aimerais savoir pourquoi mon Acrobat.exe reste ouvert dans mes processus ? | et comment le fermer | | Merci | Marc | | | Dim AcroExchApp As Acrobat.CAcroApp | Dim AcroExchPDDoc As Acrobat.CAcroAVDocDim AcroExchInsertPDDoc As | Acrobat.CAcroPDDoc | Dim AcroExchInsertPDDoc2 As Acrobat.CAcroPDDoc | Dim strFileName As String ', strPath As String | Dim iNumberOfPagesToInsert As Long | Dim iLastPage As Long | | Set AcroExchApp = CreateObject("AcroExch.App") | Set AcroExchPDDoc = CreateObject("AcroExch.AvDoc") | | | AcroExchApp.Show | Call AcroExchPDDoc.Open(Fichier_Depart, "") | Set AcroExchInsertPDDoc = AcroExchPDDoc.GetPDDoc | Cont_file = 0 | While Fichier_Insert(Cont_file) <> "" | iLastPage = AcroExchInsertPDDoc.GetNumPages - 1 | Set AcroExchInsertPDDoc2 = CreateObject("AcroExch.PDDoc") | AcroExchInsertPDDoc2.Open (Fichier_Insert(Cont_file)) | iNumberOfPagesToInsert = AcroExchInsertPDDoc2.GetNumPages | AcroExchInsertPDDoc.InsertPages iLastPage, AcroExchInsertPDDoc2, 0, | iNumberOfPagesToInsert, True | AcroExchInsertPDDoc2.Close | Kill Fichier_Insert(Cont_file) | Cont_file = Cont_file + 1 | Wend | AcroExchInsertPDDoc.Save 1, "C:JOB_PDF" & Left(MyDoc.Name, | Len(MyDoc.Name) - 4) & ".Pdf" | AcroExchInsertPDDoc.Close | AcroExchApp.Exit | Kill Fichier_Depart | Set AcroExchInsertPDDoc = Nothing | Set AcroExchInsertPDDoc2 = Nothing | Set AcroExchPDDoc = Nothing | Set AcroExchApp = Nothing | | |