Bonjour je n'arrive pas à lire le port serie de mon pc voila le code

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
31
32
 
		// Variable de communication
	HANDLE v_h_Comm;
	CString v_str_PortName = "//./COM1";	
	DWORD v_lp ;
	DCB v_dcb;
	BOOL v_b_fSuccess;
	char v_str_Trame[MAX];
	char *v_pstr_Temp = v_str_Trame;
	char v_str_Transmit[MAX];
	char v_str_Retour[1];
 
		//========== Ouverture du Port série ====================================================
	v_h_Comm = CreateFile(v_str_PortName,GENERIC_WRITE,0,0,OPEN_EXISTING,0,0);
	v_b_fSuccess = GetCommState(v_h_Comm,&v_dcb);
	v_dcb.BaudRate = 9600;
	v_dcb.ByteSize = 8;
	v_dcb.Parity  = EVENPARITY;
	v_dcb.StopBits = TWOSTOPBITS;
	v_b_fSuccess = SetCommState(v_h_Comm, &v_dcb);
	LPSTR e_str_Dest = "Dest";
	LPSTR e_str_Message = "toto";
	OVERLAPPED m_Ov;
 
		//Lecture du port
 
 
 
			BOOL etat = ReadFile(v_h_Comm,&v_str_Retour,3,&v_lp,&m_Ov);
 
 
			CloseHandle(v_h_Comm);