Salut les amis,
j'essaye d'intégrer un programme de gestion des LEDs dans un slot, j'utilise le principe d'Auto connect, j'ai fais le design dans mon designer, l'application marche très bien mais lorsque j'ajoute un programme qui sert à faire clignoter une LED (et qui marche bien tout seul) il me donne l'erreur suivante:
"cannot convert 'const char*' to 'const WCHAr*' for STANCE___*LoadLibraryW<const WCHAr>'
pour être plus précis le compilateur me surligne la ligne:hLib=LoadLibrary("inpout32.dll");
voici le slot:
int FenPrincipale::on_basculer_clicked(void)
{
info->setText("- LEDS Démarrés");
typedef short _stdcall (*inpfuncPtr)(short portaddr);
typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum);
HINSTANCE hLib;
inpfuncPtr inp32;
oupfuncPtr oup32;
short x;
int i;
/* Load the library */
hLib = LoadLibrary("inpout32.dll");
if (hLib == NULL) {
printf("LoadLibrary Failed.\n");
return -1;
}
/* get the address of the function */
inp32 = (inpfuncPtr) GetProcAddress(hLib, "Inp32");
if (inp32 == NULL) {
printf("GetProcAddress for Inp32 Failed.\n");
return -1;
}
oup32 = (oupfuncPtr) GetProcAddress(hLib, "Out32");
if (oup32 == NULL) {
printf("GetProcAddress for Oup32 Failed.\n");
return -1;
}
/***************************************************************/
/* now test the functions */
/* Try to read 0x378..0x37F, LPT1: */
for (i=0x378; (i<0x380); i++) {
x = (inp32)(i);
printf("port read (%04X)= %04X\n",i,x);
}
/***** Write the data register */
i=0x378;
int z=0;
int titi=0;
do
{
do
{
x=0xF0;
(oup32)(i,x);
z++;
}
while(z<=10000);
printf("port write to 0x%X, datum=0x%2X\n" ,i ,x);
/***** And read back to verify */
x = (inp32)(i);
printf("port read (%04X)= %04X\n",i,x);
z=0;
/***** One more time, different value */
do{
i=0x378;
x=0x0F;
(oup32)(i,x);
z++;
printf("port write to 0x%X, datum=0x%2X\n" ,i ,x);
}
while(z<=1000);
titi++;
}
while (titi<=1000);
/***** And read back to verify */
x = (inp32)(i);
printf("port read (%04X)= %04X\n",i,x);
FreeLibrary(hLib);
return 0;
}
Partager