|
AfxIsValidAddress [ ^]?
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.
[my articles]
|
|
|
|
|
Electronic75 wrote: Still I'm sure most of you guys know about the function that checks validity of a pointer to be in valid memory space.
AfxIsValidAddress() is a wrapper around IsBadReadPtr() and IsBadWritePtr() .
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
If you're worrying about having an invalid handle between checking for INVALID_HANDL_VALUE and closing it, then why aren't you worrying about the IsValidHandle routine returning TRUE, then the handle becoming invalid?
As Cedric has been trying to tell you until he's blue in the face, you NEED some sort of synchronisation (eg Critical Section) if you can open close these from different threads.
Also, if you have multiple threads all able to close a handle, then your program is badly tangled already...
Good luck,
Iain.
Iain Clarke appearing by Special Request of CPallini.
|
|
|
|
|
I think I said in another post that this handle only is closed by one thread and after closing all other threads. Thanks for the effort Cedric . I noticed a mistake of mine. while critical section is not necessary because never two threads use it synchronously but I noticed that mistakenly I terminate the thread and after that I try to close handle that has been created within that thread .No wonder! silly !
thanks all you guys, you are really helpful
|
|
|
|
|
You need to refer the API documentation,
The API that returns HANDLE to system resource has different behaviour on return values, for example CreateFile returns INVALID_HANDLE_VALUE while CreateEvent returns NULL on failure, so checking the handle on CloseHandle depends on the API that created the Handle.
Are u looking for _CrtIsValidPointer, _CrtIsValidHeapPointer for pointer validation. AfxIsValidAddress (MFC)
modified on Monday, February 04, 2008 5:52:35 AM
|
|
|
|
|
bingo! AfxIsValidAddress() thanks alot RR
Oh Thanks for the point about handles I have to be more careful,
|
|
|
|
|
Hi everybody,
i like to display a Loading-Dialog right into the view, not as Modal.
So i call "Create" from the Dialog-Class and also OnInit()
The dialog will be drawn on the view, but the other controls on the view are redrawn over
this dialog.
Which handler or function does i need to override for that the dialog will be drawn at least,
for the reason that the dialog is painted OVER all other controls.
Big thanks for your help
|
|
|
|
|
play around the Z-order of the dialog window (SetWindowPos)
|
|
|
|
|
I'll try it, thanks
|
|
|
|
|
I don't think it will work to change the Z-order. The Z-order is updated according to the user activity, a click on a control will bring it to the front.
You can have a dialog in the view window using standars MFC features. Instead of deriving your view class from CView, derive it from CFormView. The CFormView embeds a standard dialog template.
|
|
|
|
|
I have plotted a graph in a Picture control. Now I want to click the mouse on top of some points of the graph and then get the coordinate of that point. Can anyone help? Many thx~~~
Kennis
|
|
|
|
|
Actually mouse click notifications (for instance, WM_LBUTTONDOWN ) provide pointer coordinates.
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.
[my articles]
|
|
|
|
|
s Mr.pallni says absolutely true..i already checked it..
raju.k
|
|
|
|
|
Have u checked on the picture control
|
|
|
|
|
Adding to CPallini, u may need to subclass the picture control to get the mouse events
|
|
|
|
|
I dont know how to get the coordinate of the picture control. So finally I subtract the offset of the top left corner of the picture control. This method may be silly but can achieve what i want to do
|
|
|
|
|
Hi..
I want use progress bar using command line programming...plz help me...
thanks in advance..
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
sharanu wrote: I want use progress bar using command line programming...plz help me...
Command line programming?
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.
[my articles]
|
|
|
|
|
|
Aaah, yes Command Line Programming. Now everything is clear
|
|
|
|
|
Command Line Programming, why didn't I realize before? My 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.
[my articles]
|
|
|
|
|
Since you don't explain further what do you mean with 'Command Line Programming', I suppose you're talking about Console applications, i.e. character oriented ones. Now what has to do a window control, like the progress bar, with a character oriented application?
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.
[my articles]
|
|
|
|
|
In graphical mode.
Maxwell Chen
|
|
|
|
|
?
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.
[my articles]
|
|
|
|
|
Remember the graphical mode in the old DOS time? It applies to the command prompt window.
Maxwell Chen
|
|
|
|