|
I once worked on a project where we used the message queue for sending results to the GUI thread.
We first tried to use an atomic counter to control how many results there was in the message queue (max 1000). And then throttled the worker threads when they were sending results faster than the GUI thread could handle. This also ensured that we wouldn't take all memory available when there was many results.
We ended up with creating a special container, where one could push and pop resuls atomicly. And instead used the message queue to signal that the container changed state from empty to containing messages. And container stopped the worker threads with an event mutex, when the message limit (1000) was reached, and this event-mutex was signalled when the GUI thread had got the message count below 500. We changed to this solution because it was kind of a misuse of the message queue to contain our results, eventhough it was an easy way to get a thread-safe queue.
Guess right solution is not use the message queue at all, but check another queue when the GUI thread is in idle-state. And an even faster solution would be to let the container to have its own memory ¨
manager, where it reuses the allocated results, instead of constantly releasing and allocating results when popping and pushing.
|
|
|
|
|
I want to display HTML links inside edit control.
Single control need to have few hyperlinks separated for which display text is different from target URL.
While right clicking on it, it need to launch default browser.
Thanks in Advance
|
|
|
|
|
Not quite sure where the question is here. It sounds like you're telling us about your day.
Assuming you're needing some help with this...
http://www.codeproject.com/KB/static/pphtmlstatic.aspx[^] should be of some help to you.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Hi Thanks for quick help!!
I think the same can be done in edit control.
Will check it.
Thanks!!
|
|
|
|
|
sabapathy_80 wrote: I think the same can be done in edit control.
Not with a normal edit control. You'll need to use a rich edit control instead.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi, I can display a single link now by that article, but I am trying to display more than one "HTML" link in single control.
Is there any article on the same?
Thanks..
|
|
|
|
|
sabapathy_80 wrote: ...but I am trying to display more than one "HTML" link in single control.
Is there any article on the same?
See here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Thanks.. I'll look in it..
|
|
|
|
|
Take a look at this[^], might be usefull.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
|
found florin visalescu's code on the screen color picker: http://www.codeproject.com/KB/GDI/screencolorpicker.aspx?msg=2871007#xx2871007xx
what code do i use to actually "show" the color that the pointer is over?
Thank you!
|
|
|
|
|
|
I did. I just wanted to increase my chances of a response.
|
|
|
|
|
this is called cross-posting, and generally not well seen.
moreover, you had all the infos you needed, if only you'd read the article entierly...
|
|
|
|
|
You have to combine the code snippets provided in article.
HDC hDC;
hDC = CreateDC("DISPLAY",0,0,0);
CPoint point;
GetCursorPos(&point);
COLORREF color;
color = GetPixel(hDC,point.x,point.y);
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
I want to Invoking a Web Service using Visual C++ .NET. Please provide me with information.
I have sample code to invoke web service using c#. The web service method has complex data as input. Please reply.
|
|
|
|
|
Your way is wrong go back to Managed C++/CLI[^].
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hello friend,
I am using one Win32 application, which communictate with service manager, service manager then load Win32 dll.
I want to create event hadler.
In loaded Win32 dll whenever I found command from device, dll should fire the event and notufy to the Win32 application.
My win32 application should make one event listener and it should receive the event whenever any event gets fire from Win32 dll.
I saw concept of event listener in C# whre we create one event handler function.Whenever user press key or mouse button it notifies to my C# application about the key.
The same way I want to create the event handler in C++ with Win32 base application
In MFC also we declare ON_BNCLICKED which notifies the event whenever button has been pressd.
Please give me a suggestion to crate the event in Win32.
Waiting for your kind reply.
Thank you.
|
|
|
|
|
Win32 events[^] would allow you to signal the application from the DLL - but pass no data.
Other alternatives include named pipes and mailslots - those would allow you to pass data from the DLL in the service manager to your application.
You want to look at interprocess communications[^] and synchronisation[^], I think.
One other alternative - if you can pass a window handle from your application to the DLL in the service manager (probably a bit tricky!), your DLL could post window messages to that window - see the documentation[^] for details.
|
|
|
|
|
const char *pVar;
we can check (pVar == NULL) for null values.
How to check when the pVar contains bad pointer(not NULL)?
|
|
|
|
|
to check bad ponter for string use
use BOOL IsBadStringPtr(LPCTSTR lpString,WORD uuMaxLen)
for example:
const char *pVar;
if(IsBadStringPtr((LPCTSTR)pVAr,1)==TRUE)
//pVar contains bad pointer or memory is not allocated to pVar
else
//pVar contains memory allocated with it
abhi
|
|
|
|
|
Simply put: you cannot. That's the reason to set pVar=NULL just before immediately after freeing its associated memory.
However it depends on your definition of 'bad pointer' (IMHO a variable wrongly pointing a valid memory area is also 'bad'...).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Thursday, January 8, 2009 6:48 AM
|
|
|
|
|
Actually the pVar is assigned NULL and passed to a DLL.
The DLL assigned pVar to bad pointer.
|
|
|
|
|
KASR1 wrote: Actually the pVar is assigned NULL and passed to a DLL.
The DLL assigned pVar to bad pointer.
Can you post the code of what the dll is doing ?
|
|
|
|