|
If it's an explicit load then wrap LoadLibrary with a named mutex.
If it's an implicit load then wrap all access points with one or more named muticies.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
i understand the logic.
Can you please send me some sample snippets if you have any? I have not worked on mutex yet and feeling difficult to understand from articles and MSDN.
My applications will be explicitly loading the Dll's.
So i understand i need to wrap the LoadLibraray() fnction in my Client application by mutex. But how will the other application know about this?
Mutex should be defined where?
|
|
|
|
|
Read: http://msdn2.microsoft.com/en-us/library/ms682411.aspx[^]
In your other reply you say it is one function you need to protect.
Something like this should work (you should add appropriate error checking):
void YOUR_EXPORT_API YourFunc ( void )
{
HANDLE mtx = CreateMutex(NULL, FALSE, "YourUniqueMutexName");
WaitForSingleObject(mtx, INFINITE);
ReleaseMutex(mtx);
CloseHandle(mtx);
}
If you can you may want to move the CreateMutex/CloseHandle code to the app init/term functions.
What happens in the above code is that the first app to call YourFunc creates a new mutex. Any other apps (or threads in the creating app) that call YourFunc will get a handle to the existing mutex when they call CreateMutex. After that the Wait function allows only one thread (across all apps) to execute the protected code at a time.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Thanks much for your help and Code!!
My problem is solved.
I read MSDN and learnt a new concept of using Mutex!!
Thanks again!!
|
|
|
|
|
Hello,
how to to get information about how many disk is available,
and about all partitions if there more then one!?
What functions to use for that?
regards
termal
|
|
|
|
|
termal wrote: What functions to use for that?
How about GetDiskFreeSpace() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello,
thank you for your info, that is what i mean!
regards
termal
|
|
|
|
|
termal wrote: GetDiskFreeSpace
better use GetDiskFreeSpaceEx
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
thanks for info!
termal
|
|
|
|
|
Hi
I am using a Tab control in my project but when I change the color of dialog box a gray tab control seemed vary bad.How can I change the color of tab control?I couldn't find this subject in my book and also my knowledge is not enough to understand the articles about owner-drawn tab controls in this site.I do not want any gray area in my dialog box.How can I do that?And if you know where can I find a source about that subject in internet,please tell it to me.
Thanks
|
|
|
|
|
try to create your own class derived from CTabCtrl
then overload WM_ERASEBACKGROUND message
and in this message you can set the default background color of your control
|
|
|
|
|
How do you fill a ellipse on a CDC without Floodfill?
thanks
|
|
|
|
|
Select a different-colored brush into the DC before drawing. There's also FillRect() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can you use FillRect() for an Ellipse or was that a morning glitch? I'm having those myself this morning.
|
|
|
|
|
bob16972 wrote: Can you use FillRect() for an Ellipse...
I guess not. I was just assuming you'd give it a starting point somewhere within the shape and it would fill until it reached the edges. I guess that's what FloodFill() is for!
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
thanks
yes it's very easy to fill a ellipse with current selected brush.
in fact my problem it's to do a pie chart. I draw a pie chart with 3 parts. How i can fill with colore each parts??
|
|
|
|
|
jerome_data wrote: I draw a pie chart with 3 parts. How i can fill with colore each parts??
Can you call Pie() three times, using a different brush each time?
[edit]
I just tried this and it worked fine.
[/edit]
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
yes it's work very fine thanksssss
i need to do now a code to calculate coordinate point from a percent value.
thanks
|
|
|
|
|
jerome_data wrote: i need to do now a code to calculate coordinate point from a percent value.
See this article[^]
|
|
|
|
|
bob16972 wrote: Can you use FillRect() for an Ellipse
Sure you can! It has the side-effect of squaring off the ellipse's corners though
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
In my project, there are some kinds of data needed to be export to excel,html and word documents, and I want to produce these files without installing excel or word program.Does anyone know suitable active controls that can do this job effectively?
Developing environment:Visual C++ 6 with MFC.
|
|
|
|
|
throne888 wrote: ...I want to produce these files without installing excel or word program.
Which will require you to know the format of those files. There may indeed be a solution, but I don't know of any other way except through Office Automation.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi ,
I am trying to build a win32 application with a GUI like photoshop's , where there are those tool windows , which are always active ( highlighted ) .
Should i be using MDI ?
Also , where can i find resources to help me build a more PRO GUI for my applications ?
Thanks in advance
|
|
|
|
|
Try CodeJock Xtreme toolkitPro, there is an adobe sample in it.
|
|
|
|
|
Check out this extended window style:
WS_EX_TOOLWINDOW Creates a tool window, which is a window intended to be used as a floating
toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window
title is drawn using a smaller font. A tool window does not appear in the task bar or in the
window that appears when the user presses ALT+TAB.
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|