|
I have an MFC dialog which is built over a layout-engine.
This dialog also contains many owner-drawn controls.
When you popup the app and start resizing it quickly, everything looks good, responds fast, cleans-up, no window trails.
After 3-4 seconds of quick-resizing, the application begins to stall and leave-trails on the screen.
I've been trying to disable things to try and find out whay may eb causing this sudden performance-degrading... but to no avail.
Perhaps this could be a bad case of no releasing DCs ? or some other male-functioning with Graphic Objects ?
Does anybody have an idea ?
|
|
|
|
|
Hi dear gurus. I am using CListCtrl in Report view, and there is one thing I'd like to try out. Is it possible to enter multiple lines of text into one single cell? I mean, if the length of the text exceeds the length of the row it gets truncated and appended with "..." or the List Control gives you a hori scroll bar to play around with.
What i am thinking about is making the word appear in the next line, but stay in the same row...
Visual example
(without word wrap)
-------------------------------
| I got too much crap in my...|
-------------------------------
| Something else |
-------------------------------
(with word wrap)
-------------------------------
| I got too much crap in my |
| brains and I don't know |
| wat to do with it. |
-------------------------------
| Something else |
-------------------------------
Can this be done? Do i need to override the DrawItem fucntion?
|
|
|
|
|
Hi~ all.
I'm in the middle of writting a simple serial comm app but there's a Question I can't understand.
In my code, just simple data communication is OK. But when I wanna make more fast data exchange in short that make a little problem. Two program A, B can communicate well with a simple line, but to make fast and recursive data communication I made a thread that writes a data line to serial port. (Thread function In B that write 8 bytes string data expecting 14 bytes reply.) If time delay between two *sending* data string is long ( 3 secs ) send and reply is OK. However if I make the delay to be short ( 2 or 1 sec ) A works all right, and B doesn't. B cannot read any data.
Between A, B there's no difference except B has a recursive writing function in thread. So I wander whether writeing to port makes a effect to reading from that one or not.
Anybody can tell me a good solution?
Sorry for my poor English.
And Thanks in advance.
|
|
|
|
|
I have not done serial communication programming so i dont know the exact solution but here is a lead.
You cant wirte to the port as and when you want it. before writeing you need to cheack the port status wheather it is ready to send any data, then you should write any data to the port.
Using the method you can avoid the unwanted delay(sleep) in ur code.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
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...
|
|
|
|