Bonjour,
J'ai une carte de contrôle pour 2 moteurs avec cette carte, j'ai un .dll et un .h pour pouvoir contrôler ces moteurs.
Mais je débute en programmation et je n'arrive pas à créer un programme chargeant le .dll et à en utiliser les fonctions.
Voici mon bout de programme en win32 console application:
Code C++ : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 /////////////////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "E:\Stage_robot\Stepper Bee +\stp.h" int _tmain(int argc, _TCHAR* argv[]) { HINSTANCE HStpDll; // declaration of variable to hold the handle to the dll HStpDll = LoadLibrary(stp.dll); // load the dll into memory and return handle return 0; } ///////////////////////////////////////////////////////////////////////////////////////
Pour l'instant je veux juste charger la dll et voici les erreurs que je reçois:
1>------ Build started: Project: stpApp, Configuration: Debug Win32 ------
1>Compiling...
1>stpApp.cpp
1>c:\users\fabien\documents\visual studio 2008\projects\programme\motors\motors\stpapp.cpp(11) : error C2065: 'HINSTANCE' : undeclared identifier
1>c:\users\fabien\documents\visual studio 2008\projects\programme\motors\motors\stpapp.cpp(11) : error C2146: syntax error : missing ';' before identifier 'HStpDll'
1>c:\users\fabien\documents\visual studio 2008\projects\programme\motors\motors\stpapp.cpp(11) : error C2065: 'HStpDll' : undeclared identifier
1>c:\users\fabien\documents\visual studio 2008\projects\programme\motors\motors\stpapp.cpp(12) : error C2065: 'HStpDll' : undeclared identifier
1>c:\users\fabien\documents\visual studio 2008\projects\programme\motors\motors\stpapp.cpp(12) : error C2065: '“stp' : undeclared identifier
1>c:\users\fabien\documents\visual studio 2008\projects\programme\motors\motors\stpapp.cpp(12) : error C2228: left of '.dll”' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\fabien\documents\visual studio 2008\projects\programme\motors\motors\stpapp.cpp(12) : error C3861: 'LoadLibrary': identifier not found
1>Build log was saved at "file://c:\Users\Fabien\Documents\Visual Studio 2008\Projects\Programme\Motors\Motors\Debug\BuildLog.htm"
1>stpApp - 7 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Si quelqu'un pouvait m'aider car je n'arrive pas à corriger mes erreurs.
Merci d'avance
Fab
Partager