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 38 39 40 41 42 43 44 45 46 47 48 49
   |  
#include "stdafx.h"
#include "Global.asax.h"
#define WIN32_LEAN_AND_MEAN /
#include <windows.h>
#include "SophisWSClass.h"
 
namespace SophisWS
{
   double SophisWSClass::getSpot(int i)
   {
      std::string t = "toto";
      SetCurrentDirectory("D:\\Logiciel\\SophisValueV2.1.0.11\\");
      HMODULE hDLL = LoadLibrary("D:\\Logiciel\\SophisValueV2.1.0.11\\DLLPrototypeD.dll"); 
 
      //on declare un pointeur sur la fonction (avec des 2 parametre ici pour multiply)
      typedef double (WINAPI * DLL_Function_Spot)(int _Value);
      DLL_Function_Spot pfn_Spot;
      //on appelle GetProcAddress(hdll,NOM_DE_LA_FONCTION_DANS_FICHIER_.REF);
      pfn_Spot= (DLL_Function_Spot)GetProcAddress(hDLL,"GetSpot");
 
      //on appelle la fonction
      double res = pfn_Spot(i);
 
     //on libère la DLL
     FreeLibrary(hDLL);
 
     return res;
   }
 
   void SophisWSClass::loadApi()
   {
      SetCurrentDirectory("D:\\Logiciel\\SophisValueV2.1.0.11\\");
      HMODULE hDLL = LoadLibrary("D:\\Logiciel\\SophisValueV2.1.0.11\\DLLPrototypeD.dll"); 
 
      //on declare un pointeur sur la fonction (avec des 2 parametre ici pour multiply)
      typedef double (WINAPI * DLL_Function_Load)();
      DLL_Function_Load pfn_Load;
 
      //on appelle GetProcAddress(hdll,NOM_DE_LA_FONCTION_DANS_FICHIER_.REF);
      pfn_Load= (DLL_Function_Load)GetProcAddress(hDLL,"LoadAPI");
 
      //on appelle la fonction
      pfn_Load();
 
      //on libère la DLL
      FreeLibrary(hDLL);
    }
}; | 
Partager