sorry for distrubing
-
Sorry for distrubing all. i have to create communication Between modem and Pc through RS-232. 1)i created a port along with activeX(microsoft Communication control, version 6.0)control.it works well and opened the serial port. 2)my dialoge box is having all port configaration controls(like hyperterminal) and after that two edit boxes one for commands to modem,after that submit button. next there will edit box for responces for Modem. 3)iam not able to create thread for communication b/w pc and modem. which fuctions i have to call.pls anybody help 4)iam successfully completed the communication B/w two sys by RS-232 port. here is the thread where i used in Communication b/w in two sys
UINT ReaderThread(LPVOID lParam) { CString strCount; VARIANT vtResult; CString str,str1; CSerialcomDlg* m_wnd = (CSerialcomDlg*)lParam; while(1) { int nCount = m_wnd->m_CommControl.GetInBufferCount(); if(nCount > 0) { strCount.Format("%d",nCount); for(int i = 0; i< nCount;i++) { vtResult = m_wnd->m_CommControl.GetInput(); str.Format("%s",(LPCSTR)(_bstr_t)vtResult); str1 = str; } m_wnd->m_edtrecvdata.SetWindowText(str1); } } return TRUE; }
-
Sorry for distrubing all. i have to create communication Between modem and Pc through RS-232. 1)i created a port along with activeX(microsoft Communication control, version 6.0)control.it works well and opened the serial port. 2)my dialoge box is having all port configaration controls(like hyperterminal) and after that two edit boxes one for commands to modem,after that submit button. next there will edit box for responces for Modem. 3)iam not able to create thread for communication b/w pc and modem. which fuctions i have to call.pls anybody help 4)iam successfully completed the communication B/w two sys by RS-232 port. here is the thread where i used in Communication b/w in two sys
UINT ReaderThread(LPVOID lParam) { CString strCount; VARIANT vtResult; CString str,str1; CSerialcomDlg* m_wnd = (CSerialcomDlg*)lParam; while(1) { int nCount = m_wnd->m_CommControl.GetInBufferCount(); if(nCount > 0) { strCount.Format("%d",nCount); for(int i = 0; i< nCount;i++) { vtResult = m_wnd->m_CommControl.GetInput(); str.Format("%s",(LPCSTR)(_bstr_t)vtResult); str1 = str; } m_wnd->m_edtrecvdata.SetWindowText(str1); } } return TRUE; }
-
Sorry for distrubing all. i have to create communication Between modem and Pc through RS-232. 1)i created a port along with activeX(microsoft Communication control, version 6.0)control.it works well and opened the serial port. 2)my dialoge box is having all port configaration controls(like hyperterminal) and after that two edit boxes one for commands to modem,after that submit button. next there will edit box for responces for Modem. 3)iam not able to create thread for communication b/w pc and modem. which fuctions i have to call.pls anybody help 4)iam successfully completed the communication B/w two sys by RS-232 port. here is the thread where i used in Communication b/w in two sys
UINT ReaderThread(LPVOID lParam) { CString strCount; VARIANT vtResult; CString str,str1; CSerialcomDlg* m_wnd = (CSerialcomDlg*)lParam; while(1) { int nCount = m_wnd->m_CommControl.GetInBufferCount(); if(nCount > 0) { strCount.Format("%d",nCount); for(int i = 0; i< nCount;i++) { vtResult = m_wnd->m_CommControl.GetInput(); str.Format("%s",(LPCSTR)(_bstr_t)vtResult); str1 = str; } m_wnd->m_edtrecvdata.SetWindowText(str1); } } return TRUE; }
krishna Vuppala wrote:
3)iam not able to create thread for communication b/w pc and modem. which fuctions i have to call.
To get started with multithreading and avoid common pitfalls, read this[^]. In my opinion the very best starting point for multithreading. When you've read the article above and understood it, you'll face a new problem: since you're using an ActiveX control and want to access it from different threads, you need to know how to cross apartment boundaries the right way using marshalling. Read Lim Bio Liong's excellent article series starting here[^]. Writing the serial communication part by yourself, not using the MSComm control, isn't that hard really. Have a look at Joe Newcomer's article here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown