Bonjours tout le monde

Voici mon problème: Je voudrais synchroniser l'exécution de mon code VB avec l'arrêt d'une DLL. Je m'explique, j'utilise VB dans un logiciel de supervision (PcVue), grâce à VB je peux mettre à jours une variable PcVue. L'exécution de ma DLL est conditionné par une certaine valeur de cette variable. Une fois le traitement de cette DLL, je voudrais savoir si celui-ci est fini.

J'avais déjà récupéré un code de synchronisation entre VB et un fichier .bat :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
 
Public Declare Sub Sleep Lib "kernel32" (ByVal dwmiliseconds As Long)
Public Const INFINITE = &HFFFFFFFF
Public Const SYNCHRONIZE = &H100000
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
 
Sub Zip()
 
Dim pid As Long
Dim phnd As Long
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(Main.Variables_globales.URL_LOG) Then
    If FileLen(Main.Variables_globales.URL_LOG) > Main.Variables_globales.TAILLE Then
 
    Call Gestion_Log("Zip fichier", "Zip")
    pid = Shell("C:\Windows\System32\cmd.exe /Cc:\Convertisseur_ZIP.bat")
        If pid <> 0 Then
            phnd = OpenProcess(SYNCHRONIZE, 0, pid)
            If phnd <> 0 Then
            Call WaitForSingleObject(phnd, INFINITE)
            Call CloseHandle(phnd)
            End If
        End If
    End If
Else
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set A = fs.CreateTextFile(Main.Variables_globales.URL_LOG, True)
End If
 
End Sub
Si vous avez une petite idée sur le sujet ??