|
If his program exits, he need not call ReleaseMutex as the mutex object itself gets destroyed [or am I highly erroneous here?]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
"highly erroneous"? that sounds painful!
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
|
Hi Nish,
Well, the thing is a little tricky, because the documentation is not conclusive on this. I haven't found nowehere that closing a mutex handle implies also releasing it, so to the best of my knowledge not calling ReleaseMutex is undefined behavior (though it is perfectly possible that everything works nevertheless).
All in all, as the guy didn't need ownership at all, I think it is better to remain on the safe side and simply setting bInitialOwner to FALSE
Regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for your thoughts and time Joaquín!
I guess you were correct in your advice to him
Regards
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Mutexes are automatically released.
Here is a quote from Helen Custler's Inside Windows NT book which talks about this history of mutants and mutexes in NT.
"The name /mutant/ has a colorful [sic] history. Early in Windows NT's development, Dave Cutler created a kernel mutex object that implemented low-level mutual exclusion. Later he discovered that OS/2 required a version of the mutual-exclusion semaphore with additional semantics, which Dave considered "brain-damaged" and which was incompatible with the original object. (Specifically, a thread could abandon the object and leave it inaccessible.) So he created an OS/2 version of the mutex and gave it the name /mutant/. Later Dave modified the mutant object to remove the OS/2 semantics, allowing the Win32 subsystem to use the object. The Win32 API calls the modified object /mutex/, but the native services retain the name /mutant/."
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Beautiful piece of wisdom
Anyway, I wouldn't rely on only this paragraph to merrily abandon mutexes unreleased, withouth stronger confirmation from the documentation.
Regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín... You have shed some light in this dark world of mine. It made as much sense as it could for a beginner C++ programmer.
where can I find the docs on how to use other tags (or are there any other)
thanks again.
Marcus
Make no little plans; they have no magic to stir your blood to action. Make big plans, aim high in work and hope
-- Daniel Burnham
|
|
|
|
|
Apart from <pre> you can use <code> to get an effect like this .
If you're including code of yours that may have the character '<', replace those with the escape sequence <
Also, you can use regular HTML tags as well.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Marcus2001 wrote:
where can I find the docs on how to use other tags
In the VC forum FAQ
--Mike--
My really out-of-date homepage
"Hey, you wanna go to the Espresso Pump and get sugared up on mochas?"
-- Willow Rosenberg
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Use the <pre> tags!
this is between two 'pre' tags
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I am trying to see if the "enter" key is hit when some object has the focus. I have tried many things and all other keys are gotten except for the "enter."
Thanks.
|
|
|
|
|
over-ride PreTranslateMessage
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
As nish says, PreTranslate message is the way to go,
if (pMsg->message == WM_KEYDOWN)
{
if (GetFocus() != GetDlgItem(IDC_ASSAY) && pMsg->wParam == VK_ENTER)
{
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
I have a simple CListCtrl that allows the user to edit the item (0). To do this the user needs to click on the item once or twice to get into "Edit" mode.
Is there a way to allow the user other ways to get into edit mode? Like pressing the right arrow key (VK_RIGHT) or something?
-kg
Ken Goguen
|
|
|
|
|
Sure, you can use something like this in the appropriate handler:
int nItem=m_list.GetNextItem(-1,LVNI_SELECTED);
if(nItem>=0){
GotoDlgCtrl(&m_list);
m_list.EditLabel(nItem);
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sometimes we over look the simple things. Thanks.
-kg
Ken Goguen
|
|
|
|
|
I have a DLL that contains a COM object. Can anybody give me some pointers on how to create an instance of that object and call one of its methods from a Win32 C++ program. The object was originally written using Visual Basic but HAS to be used in a program written in C++ using just Win32 API not MFC. I have full access to the Visual Basic source and a small understanding of COM.
Thanks in advance for any help you can give.
Steve.
|
|
|
|
|
If you know the CLSID and the IID, you can use CoCreateInstance. Do a search on MSDN for it. I can't remember if the #import works on DLL's but it does make life easier.
Michael
|
|
|
|
|
You can use my XYDispDriver class to access the com object. Or if you are comfortable with ATL, use the #import directive.
Good luck.
|
|
|
|
|
Hi Folks,
What the proper way of creating fonts so that their size don't change during a zoom in/out printing preview?
Cheers,
- xico -
|
|
|
|
|
Hi all,
I'm looking at creating one of those explorer bars in ie. Not done anything like this before, more of an MFC person up to now.
First question is, what am I trying to do? COM? COM+? ActiveX ? there are too many different terms and i'm not sure which one is relevant!
secondly, what books are a good starting point for the above?
Thanks
Jon
PS.. I've read the related articles on CP already, but still want a book.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
|
Hi,
I am trying to activate a CView derived MDI window from a CControlBar containing an image list of view thumbnails. When I double click on the thumb I want to activate the view, i.e. bring it to the top. I cannot seem to get the SendCommand message right. Can someone help me with this.
::SendMessage(???,WM_MDIACTIVATE,(WPARAM)pTheViewToActivate,0);
Where do I need to send the message to for it to process the MDI activate message? MSDN also seems to be confused about the lparam, is it needed or not?
Many thanks
Matthew
|
|
|
|
|
(WPARAM)pTheViewToActivate looks like you're trying to send a CView pointer as the wParam. You should be sending an hWnd (window handle) instead.
But that's besides the point, because i think that CMDIChildWnd::MDIActivate() does exactly what you want.
jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|