void CEMMIConfig::Config()
{
char device_name [MAX_CHARS]={“comx”}; //“Com1”; //title for dialog
not used to get handle
UINT nIndex;
HWND parent_window_handle = NULL; //::GetDlgItem(NULL,IDC_CONFIG);
BOOL return_value = FALSE;
BYTE * buffer = reinterpret_cast< BYTE * >( NULL );
unsigned long m_ErrorCode;
device_name[0]=‘\0’;
try
{
buffer = new BYTE[8192]; // insanely large buffer
}
catch( … )
{
buffer = reinterpret_cast< BYTE * >( NULL );
}
if ( buffer == NULL )
{
AfxMessageBox(“Empty buffer”,MB_OK);
return; //( FALSE );
}
//enpty buffer
memset(buffer,8192,0);
LPCOMMCONFIG communications_configuration_p = reinterpret_cast<
LPCOMMCONFIG >( buffer );
communications_configuration_p->dwSize = 8192;
communications_configuration_p->dcb.DCBlength = sizeof( DCB );
switch (port_type){
case 0: //serial port
nIndex=m_port_list.GetCurSel();
m_port_list.GetLBText(nIndex,device_name);
break;
case 1: //IR port
nIndex=m_irport_list.GetCurSel();
m_irport_list.GetLBText(nIndex,device_name);
break;
case 2: //TCP port
nIndex=m_tcpport_list.GetCurSel();
m_tcpport_list.GetLBText(nIndex,device_name);
break;
default:
AfxMessageBox(“NO match”,MB_OK);
return;
break;
}
//AfxMessageBox(m_port_list.GetWindowText,MB_OK);
if (nIndex ==LB_ERR){
AfxMessageBox(“No selection”,MB_OK);
return; //no text in selection window
}
AfxMessageBox(device_name,MB_OK);
//device name picked up correctly as tcpip1, IR1
//next function oly works when Device_name = com1 com2
//other wise error 87 returned;
return_value = ::CommConfigDialog(device_name, parent_window_handle,
reinterpret_cast< LPCOMMCONFIG >( buffer ) );
#if 1
if ( return_value == FALSE )
{
m_ErrorCode = ::GetLastError();
//WFCTRACEERROR( m_ErrorCode );
sprintf(device_name,“Error retrurned %d”,m_ErrorCode);
AfxMessageBox(device_name,MB_OK);
delete buffer;
buffer = reinterpret_cast< BYTE * >( NULL );
return; //( FALSE );
}
#endif
delete buffer;
buffer = reinterpret_cast< BYTE * >( NULL );
}
What is the correct values for the device_name ?
Robert Fernando
Anite Telecoms Ltd
110 Fleet Road
Fleet
Hampshire GU51 4BL
United Kingdom
Tel: +44 (0) 1252 775200
Fax: +44 (0) 1252 775 321
Email: xxxxx@anitetelecoms.com
Anite Telecoms Limited Registered in England No. 1721900 Registered
Office: 100 Longwater Avenue, GreenPark, Reading, Berkshire RG2 6GP,
United Kingdom
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com