Bonjour,
Je voudrai récupérer les événements d'un objet COM. Je sais lancer un processus à partir de jacob. Pendant ce processus, cet objet COM génère différents événements.
J'ai des exemples en Visual Basic qui montre l'utilisation des evenements de cet objet.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 Private Sub Solver_OnBetterSolution(Cancel As Boolean) Dim I As Integer, K As Integer UpdateStat End Sub Private Sub Solver_OnInit(ByVal EvtMsg As String) InitProgressBar (EvtMsg) End Sub Private Sub Solver_OnProgress(Cancel As Boolean, ByVal PercentValue As Long) UpdateProgressBar (PercentValue) Cancel = (CurrentProcess = psStopped) End Sub
Maintenant, je voudrais etre capable de récupérer cet événement dans mon code java. J'ai regardé dans l'exemple fournit par Jacob concernant les événements sur IE, mais mon code génère des erreurs.
Voici mon code java:
Et voici les erreurs générées :
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
35
36
37 public class SolverEvents { public SolverEvents() { super(); } public void OnInit(Variant[] args) { System.out.println("java callback for init!"); } public void OnProgress(Variant[] args) { System.out.println("java callback for progress!"); } public void OnBetterSolution(Variant[] args) { System.out.println("java callback for betterSolution!"); } public void OnWarning(Variant[] args) { System.out.println("java callback for warning!"); } } public class Solver extends Dispatch { public Solver(Dispatch dispatch) { this.m_pDispatch=dispatch.m_pDispatch; dispatch.m_pDispatch=0; } public void solve(String duration, long solveGoal){ SolverEvents se = new SolverEvents(); DispatchEvents de = new DispatchEvents(this, se); Dispatch.call(this,"Solve",new Variant(duration), new Variant(solveGoal)); } }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 Exception in thread "Thread-3" java.lang.UnsatisfiedLinkError: init at com.jacob.com.DispatchEvents.init(Native Method) at com.jacob.com.DispatchEvents.<init>(DispatchEvents.java:68) at fr.optimizer.Solver.solve(Solver.java:149) at fr.optimizer.Optimizer.optimize(Optimizerer.java:146) at fr.optimizer.Optimisation.run(Optimisation.java:188) at java.lang.Thread.run(Unknown Source)
Quelqu'un aurait il une idée de mon problème ?
Merci
Partager