Bonjour à tous,

voici le sujet :

soit une Dll : Test.dll
soit la fonction suivante dans Test.dll avec 2 paramètres de type String : Fonction01(strChaine01 as String, strChaine02 as String) As long

Une manipulation classique serait la suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
Declare Function Fonction01 Lib "Test.dll" (ByVal strChaine01 as String, ByVal strChaine02 as String) As Long
Ensuite, aucun soucis pour manipuler Fonction01.

Mon souhait est de manipuler la fonction par le biais des pointeurs, et là, je sèche...

Voici le début de ma réflexion :
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
 
Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
 
Public Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
 
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
 
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
                          (ByVal lpPrevWndFunc As Long, ByVal hWnd As         Long, ByVal Msg As Long, _
                          ByVal wParam As Long, ByVal lParam As Long) As Long
 
Public Sub LancerFonction01()
 
  Dim lngDll           As Long
  Dim lngFonction   As Long
 
  lngDll = LoadLibrary(App.Path & "\Test.dll")
 
  if lngDll <> 0 then
 
      lngFonction = GetProcAddress(lngDll, "Fonction01")
 
      '''Mais là, c'est la panne : comment je passe les paramètres, ici de type String, à ma fonction ???????
 
 
  End If
 
  FreeLibrary lngDll
 
End Sub
J'ignore si je suis très clair, et vous remercie d'avance de votre contribution.