Bonjour,

Je suis entrain de développer une application avec MVS 2010, j'essaye de me connecter une machine, j'ai la dll qu'il faut.

Dans un premier temps je voudrais savoir si mon code est bon ou pas.

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
 
#include "stdafx.h"
 
typedef OLECHAR FAR* BSTR;
 
typedef bool (WINAPI* DLL_Function_Connect_Net) (BSTR, long); 
///typedef bool (WINAPI* DLL_Function_GetUserInfo) (int, int, string*, string*, int, bool); 
 
DLL_Function_Connect_Net Connect_Net; 
//DLL_Function_GetUserInfo GetUserInfo;
 
int _tmain(int argc, _TCHAR* argv[])
{
	HINSTANCE HStpDll = LoadLibrary(_T("zkemsdk.dll"));
 
	Connect_Net = (DLL_Function_Connect_Net)GetProcAddress( HStpDll, "Z_Connect_NET");
	//GetUserInfo = (DLL_Function_GetUserInfo)GetProcAddress( HStpDll, "Z_GetUserInfo");
 
	bool result = false;
 
	cout << "Result [ " << result << " ]\n";
 
	BSTR IP_adresse = SysAllocString(L"192.168.1.201");
	char* IP_adresse_char = "192.168.1.201";
	result = Connect_Net(IP_adresse, 4370);
 
	cout << "Result [ " << result << " ]\n";
 
	return 0;
}
L'erreur
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.