|
Where else could I store the placements of my dialogs? I thought OnDestroy was the place....any suggestions?
Appreciate your help,
ns
|
|
|
|
|
Please check out Joaquín's suggestion. OnDestroy of what? What is parent of the dialogs? How do create them?
P.S. When you tried the change did ShowWindow worked right?
|
|
|
|
|
I'm using the OnClose() instead.......thanks,
ShowWindow in OnDestroy didnt work .....but the WM_CLOSE is where I needed to be it seems. Have a good weekend!
Appreciate your help,
ns
|
|
|
|
|
What window is the parent of those modeless dialogs? If they have no parent, it could be they've been destroyed by the time CYourFrameWnd::OnDestroy is called.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquin, I spawned the CDialogs fromn CView. WHat I've now done is not trapped WM_DESTROY in the mainframe, but WM_CLOSE, and its doing its registry saving quite happily in there......
Thanks to both of you!
I'll have to get more info on what exactly happens when these msgs are received. All I know is WM_CLOSE first then WM_DESTROY......
Appreciate your help,
ns
|
|
|
|
|
Hello,
I'm handling the LVN_ITEMCHANGED message for my ListCtrl (listview) derived class. And when I click the listCtrl I receive more than one message.
I would like to know the differences between those messages and their meaning in order to handle the notification as I need to.
I would like to receive any link to where I could find info about it or direct help about how to filter the message.
Thank you in advance.
|
|
|
|
|
I need to do two things in my VC++ 6 (MFC) application:
- Close it automatically when some processes have finished.
- Start automatically the process.
This last point I can do, however, when the dialog doesn't appear until the process has finished. I have a dialog with a progress bar and I want it to appear and then immediately start the process (the process is a file exploration that works fine!).
Thanks a lot.
-- n
|
|
|
|
|
AfxGetMainWnd()->PostMessage(WM_CLOSE);
is one way
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Thanks so much. The application is closed programatically without any problem.
Now, reagrding the other problem I had:
I start some processes automatically whne the applicaction is started, but the dialog doesn't appear until the end of the process. I have a progress bar and an edit box controls that monitor the progress of the processes, so I need to see them, what can I do?
thanks.
-- n
|
|
|
|
|
What kind of processes do you start? If it's only some functions you should call them in their own thread, otherwise your gui won't be updated.
|
|
|
|
|
Thanks so much.
Solved.
-- na
|
|
|
|
|
|
No, no difference at all.
The opposite situation, having objects of type A and B pointed to by pointers of type A, usually won't show any difference either, except in complicated situations involving multiple virtual inheritance.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
There are 3 issues to performance with virtual function:
1. vtable construction and destruction
Each time an instance of the class is constructed or destructed, the vtable pointer must be updated. Thus if the nesting is 2 classes deep, (i.e. B inherits from A), then the vtable pointer is set twice during construction and twice during destruction.
2. Indirect calls
When a call do a vtable is made, instead of a "CALL XYZ", there has to be two instructions. The first is to fetch the address of the vtable (i.e. MOV EAX, [ECX]), and then the actual indirect call (i.e. CALL [EAX+10h] to invoke the 4th routine in the vtable.) (NOTE: I think I'm right on this one...)
3. Thunking for multiple inheritance.
The final thing is if you invoke a virtual method of a base class that is the 2nd or greater base class, then the address of the class instance must be adjusted prior to the call. This is so that the base class routine receives the proper class instance address.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
There are 3 issues to performance with virtual function:
4. (and the most significant IMHO): the compiler cannot optimize virtual functions (which are lete-bound) like non-virtual functions (compile-time bound).
|
|
|
|
|
Oooo. Good addition.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
then, would the situation change if class B inherits from another class, class C in addition to class A?
No, only if virtual multiple inheritance is used.
what would the difference be if class B did not have any base class at all?
If B has no base at all, you can hardly point to a B object with an A pointer. What's the scenario you're thinking about?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
How to add element to desktop's menu and to control this element from my MFC application?
|
|
|
|
|
I have this piece of code :
CString tmp;
int x = 1;
tmp.Format("%d,%d,%d",++x,++x,++x);
AfxMessageBox(tmp);
x = 1;
tmp.Format("%d,%d,%d",x++,x++,x++);
AfxMessageBox(tmp);
I always thought that output of this will look like this :
4,3,2 and 3,2,1.
But when i compile that in debug mode (no optimalisations) :
4,3,2 and 1,1,1
Release mode :
4,4,4 and 1,1,1
What's wrong ? Even if my assumptions was incorrect, i think that such trivial code should work by the same way in debug and release version.
Who knows the answer ?
(I use VC++ 6.0 with some service pack, i think
rrrado
|
|
|
|
|
rrrado wrote:
What's wrong ? Even if my assumptions was incorrect, i think that such trivial code should work by the same way in debug and release version.
Well, for me it does.
Your Problem is somewhere else, I think.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
What version do you use ? What are your results ?
rrrado
|
|
|
|
|
Both Times what you report for Debug version (4,3,2 and 1,1,1).
And I have VC++6.0 Professional, SP4 (I think, but definetly more than 3).
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
To the best of my knowledge, this is not a VC++ bug. First of all, the order of evaluation of parameters in a function invocation is unspecified, so hoping for 4,3,2 is as reasonable as 3,4,2 or whatever order. But, as you point out, this does not explain the 1,1,1 output and the difference between release and debug mode. The standard says with respect to the modification of values (¶5.4):
Between the previous and next sequence point a scalar object shall
have its stored value modified at most once by the evaluation of an
expression. Furthermore, the prior value shall be accessed only to
determine the value to be stored. The requirements of this paragraph
shall be met for each allowable ordering of the subexpressions of a
full expression; otherwise the behavior is undefined. [Example:
i = v[i++];
i = 7, i++, i++;
i = ++i + 1;
i = i + 1;
--- end example] In layman's words, you cannot increment the value of a variable more than once in a single expression: if you do so, any behavior can be expected, and VC++ is free to do different things depending on the debug/relase mode (it could even fail to compile and issue this as an error, which would be the most sensible thing to do).
If you're curious as to what's the reason behind this restriction, it probably helps compilers a great deal in optimizing scalar expressions.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|