|
WM_DESTROY (OnDestroy() ) is called when the window is destroyed, whether this is because the user has closed (via OK/Canel buttons, etc.) or because the application is closing. I generally do window-specific cleanup with this message.
WM_NCDESTROY (OnNcDestroy() ) has the distinction of being the very last message ever sent to a window, sent even after WM_DESTROY . This is useful in situations where you need to clean up internal data structures needed for message processing (for instance, delete this; ).
WM_CLOSE (OnClose() ) is a request. This message is sent when the user wishes the window to close (triggered by OK/Cancel, title bar close button, sysmenu, etc.). The default behavior is to call DestroyWindow() which eventually results in the sending of WM_DESTROY and WM_NCDESTROY message... but this is not required (though it's a good idea if you have window features that obviously should result in the window closing).
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
The best way to answer this is to create a handler for each, and then close the dialog in all ways possible (e.g., Alt+F4, X). Note which handlers get called for each condition.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Is there anyway to draw button on the fly? Currently all the examples I see are prepare before hand or with .rc.
Ie is there way to draw CButton checkbox in OnDraw?
|
|
|
|
|
yes you can create buttons on the fly, but there are problems when adding event handlers for them; you can't easilly add message map entries with on the fly ID; you need to reserve a range of IDs for the buttons.
or you can create your own class of button that notify a parent window.
for the second part, yes, I'm pretty sure you can do it, but you need to paint everything.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Shoot that's going to be little tough
I need check box for unknown number of element(until I read from the text file)
I need to display info from the text file with check box next to each line.
|
|
|
|
|
If you need to display each line of text from a text file with a check box next to it, and if the user is not going to edit the text (but even if he was, you could work around that), and if you don't have thousands of text lines, then why not look into the List Box with Checked style - it puts a checkbox at the begining of each line.
If possible, save yourself some trouble.
|
|
|
|
|
or just create the checkboxes, handle OnCommand for the dialog and see what the message is and (like the other post said, use a certain range of id's), then see which ID it is. you'll specify the id when you create it, which shouldn't be hard to increment by 1 for each successive checkbox.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Hello,
I have a dialog based application. One of the dialogs has a web browser control.
The dialog has a member variable of type CString. This varialbe contains the absolute path to the file I want to display eg: C:/Programs/Test.html
The code I use to display the file is:
<br />
m_explorer.Navigate(m_pathToFile, 0, NULL, NULL, NULL);<br />
The code is executed in the OnInitDialog() of the dialog.
The page works fine when opened in IE but when I open it in my web browser control it shows a grey box where the applet should be.
Any suggestions as to what might be the problem and how I might fix it?
Thanks very much,
dlarkin77
|
|
|
|
|
<br />
class classA <br />
{<br />
public:<br />
addObject(Object newObject); <br />
<br />
private:<br />
list<Object> objectList;<br />
};<br />
<br />
class classB <br />
{<br />
private:<br />
classA* Aptr;<br />
void addObjectToClassA();<br />
};<br />
void ClassB::addObjectToClassA() <br />
{<br />
Object newObject();<br />
Aptr->addObject(newObject);<br />
}
Hello all,
I have what is probably a simple question, but I've been wrestling with it for a while. I have code that looks like what I typed above. classA has an std::list of Objects. classB has a method that will add a new Object to that list in classA. As I understand it, it creates a copy of the Object and the copy is what is added to the list.
How can I iterate over objectList and actually modify the objects in the list? When I iterate now it seems that the Objects in the list are not modified... It seems that copies are modified instead. I thought one option would be to make objectList a list of pointers to Objects instead... But what will happn when I add an object to the list in classB? If I create a local Object* and add that to the objectList, does the pointer get added or does a copy of the pointer get added? (I'm just worried that the pointer won't refer to anything after addObjectToClassA() exits).
Thanks!
-Jordan Atlas
|
|
|
|
|
I don't believe that a copy is made when you add something to a list, but either way, if a pointer is copied, it still points to the same memory address.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
but either way, if a pointer is copied, it still points to the same memory address.
Yes, but if I have a function like this:
<br />
void ClassB::addObjectToClassA() <br />
{<br />
Object* newObject;<br />
Aptr->addObject(newObject);<br />
}<br />
What happens after the function exits? Does the pointer point to anything (sensible) anymore?
Thanks,
-Jordan Atlas
|
|
|
|
|
No, it never pointed to anything sensible.
Object * newObject = new Object();
NOW you have a pointer to something sensible, and you can make as many copies of that pointer as you like. Until you put
delete newObject;
it will continue to exist, and if you fail to ever call delete, you've got a memory leak.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
If a STL list contains objects instead of pointers to objects, then objects added to the list get copied, just like with all other STL containers.
|
|
|
|
|
Yeah, I realised after commenting that I'm too used to C# now. It's still the case that if you have an iterator, you can modify the object, and the object in the container will be modified, because you have a reference to the object in the container, right ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hello,
I am working on a VS.net SDI project, and keep all the project files in version control. What is the project.ncb file? Does it need to be included in version control?
I am sure it does not need to be included, but was just wondering before I remove from the set on controlled files that I have.
Thanks.
Jerry
|
|
|
|
|
no need to put it in version control, the ncb will be recreated by the IDE.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I am trying to call a matlab function (namely convhulln) in my C++ code. I do not know which matlab/library/dll files to include. I realize that it is a slightly complicated process to get everything right. Does anyone know of any links to working step-by-step tutorials. I have tried matlab's and a few others and haven't gotten them to work. Thanks in advance.
Tony
|
|
|
|
|
|
Hi,
1. I m learning the vc++ , some of my friends told me Microsoft will plan to quit vc++ ,bcz of . NET , is true ?
2. Is possible 2 work vc++ in .NET frame work . How ?
3. can we call vc++.net is the .net implementation of vc++ ( bcz vb -> vb.net ) ?
4. Can anyone tell me about the future of vc++ after the boom of .NET .
with lot of doubts
babuji
|
|
|
|
|
Here is one person's opinion on the subject. For every other person that you ask, you will get as many opinions.
babuji mohandas wrote:
2. Is possible 2 work vc++ in .NET frame work . How ?
Yes. Perhaps this book would be of use to you.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
Can anyone tell me how safe/unsafe it is to use dlls built in VC7.1 in the application which is built with VC6.
The dll built with VC 7.1 requires system dlls like mfc71*.dll, msvcp71*.dll, msvcr71.dll, etc. If I copy these dlls either in local foler or in system 32, the application loads fine, but Is it safe?
Please post your detailed comments. Also, if you know any URL for technical information do let me know.
Thanking you in advance.
Best regards
Vicky
|
|
|
|
|
If it's a normal win32 DLL, and the entrypoints don't take MFC classes as parameters, you should be fine, even if the DLL and the program using it use different versions of MFC internally. Passing MFC classes between modules built using different versions is just asking for trouble though.
Oh, and don't free in one module memory allocated in the other.
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
I have a 3rd party program that writes data to a selected file.
Instead of having the program write to a file, I'd like to be able to create a virtual file and capture the data the program writes.
I've tried doing it with named pipes, but I can't get it to work*.
Are there any other ways to create a virtual file?
Thanks
* Even though a simple CreateFile,WriteFile,CloseFile program works, the copy command returns "All pipe instances are busy." error and GUI programs just hang for a few seconds after I press save.
|
|
|
|
|
Forjer wrote:
I'd like to be able to create a virtual file and capture the data the program writes.
Do you mean intercept "write" calls to a certain file? If so, check out this utility.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I'm familiar with Filemon, but it doesn't help me get the data and skip the disk writing.
|
|
|
|