|
Hy people!
I have a problem
I'm doing an program in VC++ 6 under Win2K sp3, and I'm using a RichEditCtrl and works fine under 2k, but when I run the program under Win9x, the RichEditCtrl loses my CHARFORMAT formatation.
Does anybody know why?
Is this something about the version of RichEdit DLL?
What must I do?
thanks all of you for the atention,
cheers!;)
Ricky
|
|
|
|
|
I have a CDialog derived class and I'm storing pointers to the modeless objects I spawn in an STL vector. I use it like this in the View class :
int vecSize = ImageDisplayVector.size();
for (int i = 0; i < vecSize; i++)
{
CImageDisplay * pImageTemp = ImageDisplayVector[i];
pImageTemp->ShowWindow(SW_HIDE);
}
where
std::vector <CImageDisplay*> ImageDisplayVector; is global
and
class CImageDisplay : public CDialog
In the OnDestroy of the mainframe class i do the exact same thing:
int vecSize = ImageDisplayVector.size();
for (int i = 0; i < vecSize; i++)
{
CImageDisplay * pImageTemp = ImageDisplayVector[i];
WINDOWPLACEMENT wp;
pImageTemp->GetWindowPlacement(&wp);
}
It asserts in GetWindowpLacement at IsWindow()..........
So if this function (in mainframe class) thinks my pointer isnt a window (and its not null I checked) then how come SHowWindow (VIew class)happily works with the pointer?
Appreciate your help,
ns
|
|
|
|
|
Could you try the following please. In the place where you call GetWindowPlacement
int vecSize = ImageDisplayVector.size();
for (int i = 0; i < vecSize; i++)
{
CImageDisplay * pImageTemp = ImageDisplayVector[i];
pImageTemp->ShowWindow(SW_SHOW);///!!!! this is the change
WINDOWPLACEMENT wp;
pImageTemp->GetWindowPlacement(&wp);
}
I suspect at the time you call GetWindowPlacement your dialog windows are already destroyed. It could mean (depends on implementation) also that the pointer you store in the vector is invalid as well. Some MFC classes use "delete this" construct; I am not sure what you derived from.
|
|
|
|
|
Thanks a million. I have to wait a bit then I cant wait t check it out....
Appreciate your help,
ns
|
|
|
|
|
Tried it ...................wasnt the fix...;;( but thanks so much for trying.....
Appreciate your help,
ns
|
|
|
|
|
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?
|
|
|
|