bonjour,
je programme ne C++ avec borland C++ compiler 5.5 une fonction pour savoir si je suis connecté a internet :
int TestConnection(void)
{
bool connected=false;
typedef BOOL (WINAPI *PF_INETGETCONNECTEDSTATE)(LPDWORD,DWORD);
HANDLE hWinInet;
PF_INETGETCONNECTEDSTATE pfInternetGetConnectedState;
hWinInet = LoadLibrary("WININET.DLL"); //chargement de la dll
if (hWinInet == NULL)
{
//chargement de wininet.dll impossible
return 2;
}
pfInternetGetConnectedState = (PF_INETGETCONNECTEDSTATE) GetProcAddress(
[g] hWinInet, "InternetGetConnectedState"); //affectation du pointeur sur la fonction[/g]
if (pfInternetGetConnectedState == NULL)
{
//erreur d appel de la fonction InternetGetConnectedState
[g] if (hWinInet) FreeLibrary(hWinInet);[/g]
return 3;
}
DWORD TypeCon;
if (pfInternetGetConnectedState(&TypeCon,0)) connected=true; //appel de la fonction
else connected=false;
[g] if (hWinInet) FreeLibrary(hWinInet); //liberation de la dll[/g]
if (connected) return 0;
else return 1;
};
j ai recupéré une partie du code, il devrait normalement fonctionner pourtant a la compilation il me met les erreurs suivantes:
error2034 internet.cpp 25: Cannot convert 'void *' to HINSTANCE__ *' in function TestConnection()
Error2342 internet.cpp 25: Type mismatch in parameter 'hModule' (wanted 'HINSTANCE__ *', got 'void *') in function TstCnnection()
error2034 internet.cpp 29 Cannot convert 'void *' to HINSTANCE__ *' in function TestConnection()
Error2342 internet.cpp 29 Type mismatch in parameter 'hModule' (wanted 'HINSTANCE__ *', got 'void *') in function TstCnnection()
error2034 internet.cpp 35: Cannot convert 'void *' to HINSTANCE__ *' in function TestConnection()
Error2342 internet.cpp 35: Type mismatch in parameter 'hModule' (wanted 'HINSTANCE__ *', got 'void *') in function TstCnnection()
les lignes a erreurs sont en gras
si qq1 peut m expliquer ce qui va pas.
sinon on m a dit que cette methode pour savoir connaitre l etat de la connection internet ne marchais pas sur toutes les configs, si qq1 en connait une autre.
Merci
KOLLIBAR bare