Click here to Skip to main content
15,921,837 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: minimize all windows Pin
ashish dogra20-Jul-06 1:39
ashish dogra20-Jul-06 1:39 
GeneralRe: minimize all windows Pin
goodoljosh198020-Jul-06 1:42
goodoljosh198020-Jul-06 1:42 
GeneralRe: minimize all windows Pin
ashish dogra20-Jul-06 1:51
ashish dogra20-Jul-06 1:51 
AnswerRe: minimize all windows Pin
goodoljosh198020-Jul-06 1:55
goodoljosh198020-Jul-06 1:55 
QuestionRe: minimize all windows Pin
David Crow20-Jul-06 3:47
David Crow20-Jul-06 3:47 
AnswerRe: minimize all windows Pin
earl20-Jul-06 3:51
earl20-Jul-06 3:51 
AnswerRe: minimize all windows Pin
ThatsAlok21-Jul-06 1:18
ThatsAlok21-Jul-06 1:18 
QuestionMultiByteToWideChar Pin
tanarnelinistit20-Jul-06 1:31
tanarnelinistit20-Jul-06 1:31 
i have the folowing function that doesn't work:
i get an error like: "MultiByteToWideChar' : cannot convert parameter 5 from 'char *' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast"


void CMina_sView::OnListenCom1()
{
CSerial serial;
LONG lLastError = ERROR_SUCCESS;
TCHAR tszMsg[200];
lLastError = serial.Open(_T("COM5"),0,0,false);
lLastError = serial.Setup(CSerial::EBaud9600,CSerial::EData8,CSerial::EParNone,CSerial::EStop1);
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)
{
// Read data, until there is nothing left
DWORD dwBytesRead ;
char szBuffer[101];
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';

// Convert the ANSI data to Unicode
LPTSTR lpszBuffer = LPTSTR(_alloca((dwBytesRead+1)*sizeof(TCHAR)));
MultiByteToWideChar(CP_ACP, 0, szBuffer, strlen(szBuffer), lpszBuffer, sizeof(lpszBuffer)+1);
m_pSet->AddNew();
m_pSet->m_Nume=szBuffer;
m_pSet->m_Serie="asfasdvce";
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();



}
while (dwBytesRead == sizeof(szBuffer)-1);
}


// Close the port again
serial.Close();

}
AnswerRe: MultiByteToWideChar Pin
Jetli Jerry20-Jul-06 1:41
Jetli Jerry20-Jul-06 1:41 
AnswerRe: MultiByteToWideChar Pin
Steve S20-Jul-06 1:44
Steve S20-Jul-06 1:44 
AnswerRe: MultiByteToWideChar Pin
bosfan20-Jul-06 1:49
bosfan20-Jul-06 1:49 
AnswerRe: MultiByteToWideChar Pin
Naveen20-Jul-06 1:50
Naveen20-Jul-06 1:50 
GeneralRe: MultiByteToWideChar Pin
tanarnelinistit20-Jul-06 3:23
tanarnelinistit20-Jul-06 3:23 
QuestionRe: MultiByteToWideChar Pin
David Crow20-Jul-06 3:49
David Crow20-Jul-06 3:49 
AnswerRe: MultiByteToWideChar Pin
tanarnelinistit20-Jul-06 3:54
tanarnelinistit20-Jul-06 3:54 
GeneralRe: MultiByteToWideChar Pin
Naveen20-Jul-06 17:27
Naveen20-Jul-06 17:27 
QuestionDate and Time Picker Pin
goodoljosh198020-Jul-06 1:27
goodoljosh198020-Jul-06 1:27 
AnswerRe: Date and Time Picker Pin
krmed20-Jul-06 2:24
krmed20-Jul-06 2:24 
AnswerRe: Date and Time Picker Pin
-Dy20-Jul-06 2:31
-Dy20-Jul-06 2:31 
QuestionWhere is the mouse?? Pin
Dimitris Vikeloudas20-Jul-06 1:11
Dimitris Vikeloudas20-Jul-06 1:11 
AnswerRe: Where is the mouse?? Pin
Blake Miller20-Jul-06 7:05
Blake Miller20-Jul-06 7:05 
AnswerRe: Where is the mouse?? Pin
Roger Allen20-Jul-06 11:52
Roger Allen20-Jul-06 11:52 
QuestionAdministrator Privilege [modified] Pin
ragavan19-Jul-06 23:50
ragavan19-Jul-06 23:50 
AnswerRe: Administrator Privilege Pin
Naveen19-Jul-06 23:57
Naveen19-Jul-06 23:57 
AnswerRe: Administrator Privilege Pin
Mike Dimmick20-Jul-06 0:22
Mike Dimmick20-Jul-06 0:22 

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.