|
It wasn't his verbiage that bothered me (I'm from Oklahoma so I get accused of talking funny all the time). It was that he talked about modal while linking to a modeless article.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: It was that he talked about modal while linking to a modeless article.
Ah, he's taking the zen approach to computer programming. Learn X, by learning about ~X.
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
That reminds me of an incident in the elevator yesterday. The elevators in the lobby of our building can go up (to floors 2-15), or down (to floors B and SB). Above the elevator doors are red arrows pointing down. They are lit when the elevator is going down (and unlit otherwise) to let those getting on know where they are headed to. I got on yesterday with a guy that was apparently new to the building. We were both going up. Because I had gotten on so quickly, he asked me how I knew that the elevator was indeed going up. I told him it was because the red arrows did not tell me it was going down. Sort of a reverse logic thing.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You are going to be in trouble when the bulb breaks!
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Iain Clarke wrote: You are going to be in trouble when the bulb breaks!
They are already somewhat unreliable (built in the 50s). Worst case, and has happened, I go to the 7th floor via the sub-basement.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can be used SetupComm() after port initialization and reading of some data to change buffer sizes?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
No, after you have read data...you will need to close the handle, reopen it and call SetupComm() before reading/writing.
Best Wishes,
David Delaune
|
|
|
|
|
Thanks!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Hello,
can I somehow find out how many thread are waiting
for an event on WaitForSingleObject (or how many Threads
have been released when setting it?
Alex
|
|
|
|
|
WaitForSingleObject waits for only one object. And to know the state of a thread, use getExitCodeThread.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Thank you for your answer.
VuNic wrote: WaitForSingleObject waits for only one object.
But multiple threads can wait for one object - and I would like to know how many. The problem is:
when I use a (synchronized) counter before the WaitForSingleObject,
how do I know if the Thread has already reached it and is waiting
or was interrupted before - I can not unlock the counter atomically
with the WaitForSingleObject call...
Alex
|
|
|
|
|
LionAM wrote: how do I know if the Thread has already reached it and is waiting or was interrupted before
There's no way reliably. What thread would be examining this thread to see where it's at?
What are you trying to do and how is this counter involved? There may be a simpler solution
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I wanted to implement a multiple reader/single writer lock.
The counter counts the number of waiting readers (which
then wait until the event is set).
If a writer unlocks, it sets (or pulses if there are writers
waiting) the event so that all waiting readers can resume -
but only if they already wait.
Alex
|
|
|
|
|
The lack of an atomic lock/counter-adjust API makes it tricky.
There's a ton of solutions on the web (e.g. search "reader writer lock") that vary in performance and whether
they favor the reader thread(s) or the writer thread(s).
Even if you're looking to design your own, they're worth looking at IMO.
Here's an interesting article: Implementing a Reader-Writer lock[^]
along with its companion article: Analysis of Reader-Writer lock[^]
Here's a simple example - straight forward, if performance isn't a major concern: Reader/Writer Lock[^]
Hope that helps a bit,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have found a very simple and short solution, using only
two "fast critical sections" (interlocked bool) and one
(interlocked) counter - and less than 20 lines of code.
Alex
|
|
|
|
|
Cool!
As long as it meets your performance requirements and doesn't deadlock
Like I mentioned, there's lots of ways to do it - with "big" performance differences between
the solutions.
Glad you found a solution!
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
AFAIK, no, not with Windows synchronization objects.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Friends, I am working on the code, wrote by somebody.. I added a new menu Item in the resource.. say "xyz", during the
runtime it is shown as "@xyz@".. I need it as "xyz",
how to handle this friends..
|
|
|
|
|
ptr_Electron wrote: how to handle this friends
Fix it friend
led mike
|
|
|
|
|
Thanks for ur responce friend
|
|
|
|
|
Did you use of ANSI code?
|
|
|
|
|
Where we can get CImage sources (UNICODE COMPATIBLE) to load GIF, JPEG in our application ?
Anyone Please help on this.
Thanks a Lot
Thanks a lot
|
|
|
|
|
The source code is included with Visual Studio.
CImage uses GDI+ to load and save images. The loaded GDI+ image is converted to a DIBsection, which is
wrapped by the CImage class.
The loading code is similar to this (without the conversion to a DIBSection):
ULONG dwToken;
Gdiplus::GdiplusStartupInput input;
Gdiplus::GdiplusStartupOutput output;
Gdiplus::Status status = Gdiplus::GdiplusStartup(&dwToken, &input, &output);
if(status == Gdiplus::Ok)
{
Gdiplus::Bitmap *pSrcBitmap = new Gdiplus::Bitmap(L"C:\\test.jpg", FALSE);
<font color="Green">
delete pSrcBitmap;
Gdiplus::GdiplusShutdown(dwToken);
}
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Actually i am sure, there is no manual for CImage, in MS Visual Studio though it is included. If so what header i need to include to proceed?
Thanks for your response!
Thanks a lot
|
|
|
|
|
atlimage.h in VS 2008 - most of it is inline.
It used to be an MFC class so it was a different header file before.
What version of Visual Studio are you using?
If you don't have a VS version that has the class, you can always use GDI+ directly, as I showed in the sample code.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|