Devo far funzionare una periferica cha lavora con una seriale, ho trovato questa parte di codice ke dovrebbe leggermi il valore restituito
codice:
#include "stdafx.h"
#include <Windows.h>
#include <WinBase.h>


using namespace std;
using namespace System;

bool LeggiTx() {
	DWORD cerror,nbytes; 
	DWORD Timer; 
	COMSTAT ComStat; 
	bool cont,result;  
	Timer=GetTickCount();  
	cont=true;  
	result=false;  
	
	do  {   
			ClearCommError(hPort, &cerror, &ComStat);
			if (ComStat.cbInQue>0)        
			{    
				ReadFile(hPort,RxBuffer, 1,&nbytes, NULL);    
				if ((RxBuffer[0] & 0xf0)== 0xf0)    
				{     
					ClearCommError(hPort, &cerror, &ComStat);
					if (ComStat.cbInQue>=4)     
					{      
						ReadFile(hPort,&RxBuffer[1], 4,&nbytes, NULL); 
						result=true;      
						cont=false;      
						PurgeComm(hPort,PURGE_RXCLEAR);  

					}    
				}
			}   
			else   
			{    
				if ((GetTickCount()-Timer)>200) 
					cont=false;   
			}  
	}
	while (cont);  
	return result; 
}
Qualcuno saprebbe dirmi come vado a definire "hPort"?
perchè in compilazione mi dice "identificatore nn dichiarato" .
Grazie in anticipo.