|
wilche wrote:
So maybe threading is not always the best solution to improve performance?
There is no silver bullet. No, threading isn't always the best way to improve performance, though many (many many) applications could gain quite a bit of responsiveness and performance if they used threading in the right places, for the right reasons and in the right way.
|
|
|
|
|
applications could gain quite a bit of responsiveness and performance if they used threading in the right places, for the right reasons and in the right way.
This is so true. All too often I see people use threads and then fill the code with sync points (elements of the code where one thread must wait or sync with the other). Perfect threading has no sync points. Realistic threading has a few. Poor threading has the thread constantly syncing. When that happens, what is the real point.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
here's my new problem:
RedrawWindow(hWnd,NULL,NULL,RDW_FRAME | RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_ERASENOW);
how come this code doesn't end up calling the WM_NCPAINT message? i subclasses a menu window and i only get WM_NCPAINT when windows wants me to draw the new border, but i can't find a way to manually tell it to draw the border
- Roman -
|
|
|
|
|
I have a serial port class based off of CSerialPort v1.03 by PJ Naughter (stripped down and customized for my purposes) that is stripping out the 0x0A from the stream. It also stops reading when it encounters a NULL. I thought it might have something to do with Flow Control but I can't seem to pick the right combination to get all the data to just flow through. I want every single byte to make it into my application for processing.
The access is overlapped if that makes any difference.
Any help would be greatly appreciated.
Thanks,
Clint
|
|
|
|
|
Hmm...
1. Are you writing the contents of the data to a file? If so, did you open the file in text mode? That will cause the 0x0A to be removed.
2. Are you storing the data in strings and then using fprintf and such? If so, then of course the 0 is getting dropped. That is used by C to mark the end of a string.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
This is code I developed a long time ago to open a COM port for that kind of use. I hope its of use
SECURITY_ATTRIBUTES sa ;
sa.nLength = sizeof(SECURITY_ATTRIBUTES) ;
sa.lpSecurityDescriptor = NULL ;
sa.bInheritHandle = true ;
m_hSerialPort = CreateFile((LPCTSTR)m_csCommPortName,
GENERIC_READ | GENERIC_WRITE,
0,
&sa,
OPEN_EXISTING,
0,
0) ;
if (m_hSerialPort != INVALID_HANDLE_VALUE)
{
m_bOpen = true ;
if (!GetCommState(m_hSerialPort, &m_dcb))
{
error.LoadString(IDS_CAVRO_DCB) ;
DisplayText(error) ;
}
else
{
m_dcb.BaudRate = CBR_9600 ;
m_dcb.ByteSize = 8 ;
m_dcb.Parity = NOPARITY ;
m_dcb.fParity = false ;
m_dcb.StopBits = ONESTOPBIT ;
m_dcb.fDtrControl = DTR_CONTROL_DISABLE ;
m_dcb.fOutxCtsFlow = false ;
m_dcb.fDsrSensitivity = false ;
m_dcb.fTXContinueOnXoff = true ;
m_dcb.fOutX = false ;
m_dcb.fRtsControl = RTS_CONTROL_DISABLE ;
m_dcb.fAbortOnError = false ;
if (!SetCommState(m_hSerialPort, &m_dcb))
{
error.LoadString(IDS_CAVRO_STATE) ;
DisplayText(error) ;
}
if (!SetCommMask(m_hSerialPort, EV_RXCHAR))
{
error.LoadString(IDS_CAVRO_MASK) ;
DisplayText(error) ;
}
COMMTIMEOUTS timeouts ;
timeouts.ReadIntervalTimeout = MAXDWORD ;
timeouts.ReadTotalTimeoutConstant = 0 ;
timeouts.ReadTotalTimeoutMultiplier = 0 ;
timeouts.WriteTotalTimeoutConstant = 0 ;
timeouts.WriteTotalTimeoutMultiplier = 0 ;
SetCommTimeouts(m_hSerialPort, &timeouts) ;
}
}
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Hi,
I am learning C++ and have been doing pretty well until I got to this project I needed to complete. It's just a simple database, nothing fancy. I've imported msado15.dll, and have done eveything by the book but I keep getting this error upon executing the program that says "Data source name not found and no default drive specified. My instructor simply said that some people have an ODBC on thier systems and others don't. If I don't then I wont be able to get this to work. I'd like very much to concentrate on database building and design and was wondering if there is any way around this. I have WinXP Home editiion, and have just gotten (although not installed yet) pro. Any ideas would be appreciated.
Thanks,
Garry
|
|
|
|
|
|
Thank you. I did actually add it and just now I did it again thinking that maybe something went wrong the last time. Any other ideas?? Please?
|
|
|
|
|
Hi, all.
i'm reading Essential COM by Don Box, and i'm confused about the moniker class. so i look for another articles about that, can anyone provide?;)
|
|
|
|
|
Inside OLE II is the only book I know of which has monikers covered pretty well. Apart from that you can try http://www.sellsbrothers.com/tools for some sample code.
..this is a VB Programmers' world and we all are just visitors - Someone in a MSJ article
|
|
|
|
|
Into my computer:
How do I get the number version of msado15.dll?
How do I get the service pack number of Visual Studio 6?
Thanks!!!!
|
|
|
|
|
Use this addin
Click here to find VS service pack. You can refer its source code to do it programmatically.
..this is a VB Programmers' world and we all are just visitors - Someone in a MSJ article
|
|
|
|
|
Hello All,
I'm having a hard time finding or even thinking up a function or two that gathers a list of items (or better put, a branch) so that I can pass that to the clipboard. Basically, I am doing cut and paste of a treeview. The items in the tree all have objects that hold data relating to the item and the LParam of the item points to the object. So, these objects get passed on to the clipboard...it is not a problem for me to get the data that I want to pass on, the problem is going through each item and making the list. For example, there are code fragments here that copy branches and items, but those assume that the destination is a tree and those functions return a handle to the newly copied item. In my situation, there is no such newly created item.
Does anyone have any ideas on how to implement this?
Thanks,
Paul...
|
|
|
|
|
How about giving each element object a unique ID number, and providing the ID of each element's child/children nodes. You should be able to then read all the objects from the clipboard into a map and rebuild the tree
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Hi There,
Yes, it seems easy for you to say!;P Actually, each object does have a unique ID.
What's this about a map? Could you expand on that part a little bit more?
Thanks for responding to the post!
Regards,
Paul...
|
|
|
|
|
Look up CMap (MFC) in MSDN - it basically gives you a hashing table into which you can add elements with a refrence key. When you want to retrieve the element, you give it the key, and it provides the object - very handy indeed
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
OK,
Thanks for the info. Right now I'm using a CArray which sound close to what a CMap does. Well, thanks for the advice.
Paul...
|
|
|
|
|
Yeah, you can think of a CMap as a ultra-dynamic array (since if you have elements 0, and 100, it wouldn't need to allocate memory for elements 1-99)
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
I made a program that didn't allow the computer to shut down by adding WM_QUERYENDSESSION function and always returning FALSE. Now that works when I try to shut down. However, at school my teacher uses a program called Shutdown.exe and that seems to shut down the computer even when my program is running. My question is what message is Shutdown.exe sending to my computer?
-Raffi
Why do today what can be put of until tommorrow?
|
|
|
|
|
I know how I would do it. Kill all processes myself, then close Windows.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Is there any way to prevent it from killing my program?
-Raffi
Why do today what can be put of until tommorrow?
|
|
|
|
|
Raffi wrote:
Is there any way to prevent it from killing my program?
You really cannot prevent a process from being killed! Unless you really muck up the system and crash it, in which case they'd power-off and reboot anyway
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Nish - Native CPian wrote:
in which case they'd power-off and reboot anyway
I was actually wondering whether it is possible for my process to survive after power-off and reboot....
Best regards,
Alexandru Savescu
|
|
|
|
|
Alexpro wrote:
I was actually wondering whether it is possible for my process to survive after power-off and reboot....
Heheheh. Good one Alex
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|