|
Thanks.
But the delay I mean is my own setting one with Sleep(); and checked port status, too.
End of this, I'll include the code used. If I use 'Sleep(3000)' in thread function(StartThread) communication is looked OK. But if I use 'Sleep(1000)', communication is to be broken. B cant receive any data just because of shortened Sleep() time. Two programm A, B use normal serial communication routine, and B has one more thread function as following.
In StartThread 'm_Port' is CSerial Class obejct.
Again, Thanks a lot anyway.
UINT CNewParkDlg::StartThread(LPVOID param)
{
THREADSTRUCT* ts = (THREADSTRUCT*)param;
CString strPoll;
strPoll = (CString)STX + "N1PL" + (CString)ETX + "60";
int nSize = strPoll.GetLength();
while(true) {
// Display to ListBox
ts->_this->m_pListBox.InsertItem(0, strPoll);
ts->_this->m_pListBox.SetItemText(0, 1, "Send");
ts->_this->m_Port.WriteComm((BYTE*)(LPCTSTR)strPoll, nSize);
// Sleep(1000);
Sleep(3000);
}
return true;
}
typedef struct THREADSTRUCT {
CNewParkDlg* _this;
} THREADSTRUCT;
DWORD CSerialPort::WriteComm(BYTE *pBuff, DWORD nToWrite)
{
DWORD dwWritten, dwError, dwErrorFlags;
COMSTAT comstat;
int n;
n = WriteFile(m_hComm, pBuff, nToWrite, &dwWritten, &m_ovrWrite);
if (!n) {
if (GetLastError() == ERROR_IO_PENDING ) {
while ( !GetOverlappedResult(m_hComm, &m_ovrWrite, &dwWritten, TRUE) ) {
dwError = GetLastError();
if (dwError != ERROR_IO_INCOMPLETE ) {
ClearCommError(m_hComm, &dwErrorFlags, &comstat);
break;
}
}
}
else {
dwWritten = 0;
ClearCommError(m_hComm, &dwErrorFlags, &comstat);
}
}
return dwWritten;
}
|
|
|
|
|
Hi~
In ITU, it needs money to order the jpeg specification! So, do you know where
can I get the jpeg specification??
If you know or you have these specification? Please let me know!
thanks.....
Keven
|
|
|
|
|
|
Dear Ian:
I got it!
Thanks a lot~~~
keven
|
|
|
|
|
Here's another spot:
http://www.wotsit.org/
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Dear David:
It is useful to me! Thank you~~~
keven
|
|
|
|
|
Hi..
How can i applying video compression in AVI File. Any pre defined classes in VC++ or windows . Please help to slove the problem.
Thanks and Regards
Karthi
|
|
|
|
|
There is an API: Video Compression Manager, specifically see the example on Compressing Data. It shows a very brief example of compressing image data for AVI files.
You can also use other techniques to stream video into an avi encoder. A really good encoder can be found (with source) at http://www.xvid.org.
|
|
|
|
|
Hi guys,
I'm working on an email application similar to outlook express. I have problems converting the formated text in rich edit to the HTML format, I can convert it to RTF but I'm stuck there...
Should I use other controls like DHTML (which I Know Nothing About) instead of rich edit control. I think rich edit is perfect for my application but how am i going to convert it to HTML?????anyone knows a solution for this... would be a great help..
thanks...:
|
|
|
|
|
I belive there is no standard means of converting an rtf file to html, There are lot components available on the net to do the same.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Hello all
I want to modify the open dialog box in the OnOpenDocument function. It is showing "All Files" by default. I want to know more about this function.
Thanks in advance.
|
|
|
|
|
If you're using MFC, the document templates which are part of your application and which are registered are used to build the filter in the open file dialog. The best way to learn about MFC is to dig here. You can also learn all about CDocument::OnOpenDocument there.
OnOpenDocument does not actually create the dialog box you're asking about. It is a result of MFC mapping the extension to one of your registered document templates after the user selects a file. To learn about the dialog, refer to CFileDialog.
You can learn about how the MFC document, view, and application classes relate by reading TN025: Document, View, and Frame Creation.
|
|
|
|
|
Check out CDocTemplate::GetDocString() , and the IDR_MAINFRAME resource in the string table.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Does anyone know how to programmatically obtain the number of bytes received and transmitted on a network (dial-up or lan) connection ?
I appreciate any help - thanks DW
|
|
|
|
|
|
Is there a simple function call that will do the following.
Say i have 3 edit boxes side by side for the purpose of a ticket number.
and i have my user enter one number at a time for instance 1 2 3.
How can i make it jump (tab) to the next box on input? Like if he/she enteres 5 it will jump to the next box waitin input then you enter 6 it goes to the last box. I know it can be done cause i see it on webpages alot. Just not sure how to do it. thanks
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
|
thanks for the reply. I didn't use his class but I seen what he was doing. The simple SetFocus function. I have three controls m_ticket1 m_ticket2 and m_ticket3;
I just put inside the onchangeticket1() m_ticket2.SetFocus() and so on it works like a charm.
Thanks again for your help,
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
I created a SDI aplication with two views, one based on CTreeView and second
on CListView.
Wich message is sending to CListView class when I change a width of column in list control (I set a LVS_REPORT style)?
I'm sorry about my English.
Wojtek
|
|
|
|
|
WM_NOTIFY, if not mistaken.
|
|
|
|
|
It is WM_NOTIFY, but you need the right sub-message:
afx_msg void OnEndtrackConcentrations(NMHDR* pNMHDR, LRESULT* pResult);
ON_NOTIFY(HDN_ENDTRACK, IDC_CONTROL, OnEndtrackControl)
void CYourClass::OnEndtrackControl(NMHDR* pNMHDR, LRESULT* pResult)
{
You may also need to add this line to your OnInitDialog() to get the message mapped correctly, as by default the header control would report a control ID of 0:
m_Control.GetHeaderCtrl()->SetDlgCtrlID(m_Control.GetDlgCtrlID());
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
Thanks for your help.
It works, but I have one more little problem. This is list control from CListView class and I don't know its ID's. I checked this list's ID
by function GetDlgCtrlID() and I created resource symbol of its ID's value and I seted list's and header's IDs by function SetDlgCtrlID() in function OnInitialUpdate(). It works and I hope that it's a good way.
|
|
|
|
|
i wonder, at the moment, alot of text editors are created the same way. toolbars and menus on the top, on the left, treeview, on the right, tags and textarea for multidocuments (resizable) and status bar on the bottom.
how are those editors created? as a dialog based or doc/view multi documents?
thanks for all answers
|
|
|
|
|
.eh.. doc/view multi documents sounds good to me.
jhaga
---------------------------------
Every generation laughs at the old fashions, but follows religiously the new.
Henry David Thoreau, "Walden", 1854
|
|
|
|
|