Click here to Skip to main content
15,891,529 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Combo Box Value Pin
Cedric Moonen20-Jul-06 4:55
Cedric Moonen20-Jul-06 4:55 
GeneralRe: Combo Box Value Pin
Cedric Moonen20-Jul-06 5:06
Cedric Moonen20-Jul-06 5:06 
AnswerRe: Combo Box Value Pin
David Crow20-Jul-06 5:03
David Crow20-Jul-06 5:03 
QuestionHow can i detect that the system has just restarted/powered on Pin
Kim Togo20-Jul-06 3:54
professionalKim Togo20-Jul-06 3:54 
AnswerRe: How can i detect that the system has just restarted/powered on Pin
David Crow20-Jul-06 4:10
David Crow20-Jul-06 4:10 
AnswerRe: How can i detect that the system has just restarted/powered on Pin
Dimitris Vikeloudas20-Jul-06 4:23
Dimitris Vikeloudas20-Jul-06 4:23 
GeneralRe: How can i detect that the system has just restarted/powered on Pin
Kim Togo20-Jul-06 20:22
professionalKim Togo20-Jul-06 20:22 
QuestionCOM reading and string format Pin
tanarnelinistit20-Jul-06 3:52
tanarnelinistit20-Jul-06 3:52 
I have the folowing code for a function that reads a string from the COM5 port and then adds it to a table in the database. The value that i should read from COM is smth like "FFFFAAAAAAAAAA000C" but i only get "F". What's wrong?

void CMina_sView::OnListenCom5()
{
CSerial serial;
LONG lLastError = ERROR_SUCCESS;
DWORD dwBytesRead ;
char szBuffer[17];
char * point;
// Attempt to open the serial port (COM5)
lLastError = serial.Open(_T("COM5"),0,0,false);
// Setup the serial port (9600,8N1, which is the default setting)
lLastError = serial.Setup(CSerial::EBaud9600,CSerial::EData8,CSerial::EParNone,CSerial::EStop1);
// Register only for the receive event
lLastError = serial.SetMask(CSerial::EEventBreak |
CSerial::EEventCTS |
CSerial::EEventDSR |
CSerial::EEventError |
CSerial::EEventRing |
CSerial::EEventRLSD |
CSerial::EEventRecv);

lLastError = serial.SetupReadTimeouts(CSerial::EReadTimeoutNonblocking);

// Wait for an event
lLastError = serial.WaitEvent();
// Save event
const CSerial::EEvent eEvent = serial.GetEventType();
// Handle ring event

// Handle data receive event
if (eEvent & CSerial::EEventRecv)
{
do
{
// Read data from the COM-port
lLastError = serial.Read(szBuffer,sizeof(szBuffer)-1,&dwBytesRead);

// Finalize the data, so it is a valid string
szBuffer[dwBytesRead] = '\0';
}
while (dwBytesRead == sizeof(szBuffer)-1);
wchar_t* lpszBuffer = (wchar_t*)calloc(dwBytesRead+1, sizeof(WCHAR));
::MultiByteToWideChar(CP_ACP, 0, szBuffer, -1, lpszBuffer, dwBytesRead+1);

m_pSet->AddNew();
m_pSet->m_Nume="asas";
m_pSet->m_Serie=lpszBuffer;
CTime time = CTime::GetCurrentTime();
m_pSet->m_Data=time;
UpdateData(TRUE);
if (m_pSet->CanUpdate())
m_pSet->Update();
m_pSet->Requery();
UpdateData(FALSE);
m_pSet->Close();
m_pSet->Open();
Invalidate();
UpdateWindow();

}


serial.Close();

}
AnswerRe: COM reading and string format [modified] Pin
earl20-Jul-06 4:05
earl20-Jul-06 4:05 
QuestionSome question on RPC Memory allocation Pin
yccheok20-Jul-06 3:49
yccheok20-Jul-06 3:49 
QuestionInternetFindNextFile??? Pin
_AnsHUMAN_ 20-Jul-06 3:45
_AnsHUMAN_ 20-Jul-06 3:45 
AnswerRe: InternetFindNextFile??? Pin
earl20-Jul-06 3:47
earl20-Jul-06 3:47 
QuestionRe: InternetFindNextFile??? Pin
David Crow20-Jul-06 4:14
David Crow20-Jul-06 4:14 
AnswerRe: InternetFindNextFile??? Pin
_AnsHUMAN_ 20-Jul-06 4:19
_AnsHUMAN_ 20-Jul-06 4:19 
GeneralRe: InternetFindNextFile??? Pin
David Crow20-Jul-06 4:28
David Crow20-Jul-06 4:28 
GeneralRe: InternetFindNextFile??? Pin
_AnsHUMAN_ 20-Jul-06 18:20
_AnsHUMAN_ 20-Jul-06 18:20 
GeneralRe: InternetFindNextFile??? Pin
David Crow21-Jul-06 2:40
David Crow21-Jul-06 2:40 
GeneralRe: InternetFindNextFile??? [modified] Pin
_AnsHUMAN_ 21-Jul-06 2:45
_AnsHUMAN_ 21-Jul-06 2:45 
GeneralRe: InternetFindNextFile??? Pin
David Crow21-Jul-06 3:44
David Crow21-Jul-06 3:44 
GeneralRe: InternetFindNextFile??? Pin
_AnsHUMAN_ 21-Jul-06 3:59
_AnsHUMAN_ 21-Jul-06 3:59 
QuestionRe: InternetFindNextFile??? Pin
David Crow21-Jul-06 4:31
David Crow21-Jul-06 4:31 
AnswerRe: InternetFindNextFile??? Pin
_AnsHUMAN_ 21-Jul-06 4:40
_AnsHUMAN_ 21-Jul-06 4:40 
QuestionRe: InternetFindNextFile??? Pin
David Crow21-Jul-06 5:04
David Crow21-Jul-06 5:04 
Question[Message Deleted] Pin
stancrm20-Jul-06 2:48
stancrm20-Jul-06 2:48 
AnswerRe: Casting problem (String* to LPCVOID) Pin
Cedric Moonen20-Jul-06 3:13
Cedric Moonen20-Jul-06 3:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.