|
Yes, but the caption changes because my MDI frame windows use the FWS_ADDTOTITLE style. The MSDN advice does in fact work (see my reply to Chris L's note) but every time I open a doc (or switch views), the mainframe's caption gets reset to "MyApp - Doc name".
I'd like it to use "My App Pro - Doc name" or "My App Lite - Doc name" instead.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Maybe you could trap the WM_SETTEXT for you main frame?
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
No, that would cause an infinite loop when I try to set the window text myself. A cheesy solution to the problem is to create a timer and reset the window text in every WM_TIMER message. Such a hack...
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
that would cause an infinite loop when I try to set the window text myself
So just set a flag first time in so that you know not to start recursing.
Ravi Bhavnani wrote:
create a timer and reset the window text in every WM_TIMER message
Barf. NOOO!!!
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Taka Muraoka wrote:
So just set a flag first time in so that you know not to start recursing
What if another WM_SETTEXT arrives before mine is sent? (The app is multi threaded). No wait, that *might* work, since a message is fully processed before the next one is popped off the queue. Hmmm, now you've got me thinking.
But I must admit, this seems more of a hack than the yucky timer thang.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
No wait, that *might* work, since a message is fully processed before the next one is popped off the queue.
If it's a question of UI threads vs. worker threads, it's a non-issue - only the UI thread will ever be in there. So the only question is if you have >1 UI thread, but even then, I'm pretty sure you get 1 message queue per thread...
Ravi Bhavnani wrote:
this seems more of a hack than the yucky timer thang
You think? I feel the totally opposite way. The thought of un-necessarily updating the window caption every second (or whatever) instead of once, when it is actually being set, seems really ugly.
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Taka Muraoka wrote:
The thought of un-necessarily updating the window caption every second (or whatever) instead of once, when it is actually being set, seems really ugly.
I would only update it if necessary. I feel this is less hackish because it's more obvious. Overriding a low level handler like WM_SETTEXT seems more subtle and imho can have more side effects.
But all this may be moot. A friend @ work just informed me that he moved my original code to CMainFrame::OnCreate() which appears to have fixed the problem. I'll let you know if this works!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
You need to give us more information. The code you are doing looks fine, but it all depends on
when you are "calling" it.
If it is before the framework loads the resource string, then you are too early.
If it is after CMainFrame calls its SetWindowText, then you are too late...
Iain.
|
|
|
|
|
See my reply to Chris L's post. Thanks!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hey Folks,
I have a customer who has one of our applications crashing on his PC, but unfortuantely, I'm unable to replicate here. I managed to get my hands on his DR.WATSON .log which gives plenty of information, but how I do make head/tails of what exactly crashed in my program? I'm able to verify that it is our FTS.EXE that is crashing on his PC, but am I able to pin point it any futher as to maybe a function/line of where the problem occurs?
Any tips you can send would be greatly appreciated... HO HO HO...
Mike.
Here is a snippit of the log <can you="" read="" german?="" ="">:
Anwendungsausnahme aufgetreten:
Anwendung: (pid=288)
Wann: 12/17/2002 @ 17:52:26.609
Ausnahmenummer: c0000005 (Zugriffsverletzung)
*----> Task-Liste <----*
0 Idle.exe
2 System.exe
20 SMSS.exe
24 CSRSS.exe
34 WINLOGON.exe
40 SERVICES.exe
43 LSASS.exe
63 SPOOLSS.exe
71 avsynmgr.exe
94 RPCSS.exe
97 trcboot.exe
114 NMSSvc.exe
119 PSTORES.exe
112 pcs_agnt.exe
131 vsstat.exe
134 mstask.exe
138 vshwin32.exe
135 avconsol.exe
143 webscanx.exe
149 mcshield.exe
190 NDDEAGNT.exe
188 Clntrust.exe
203 NALNTSRV.exe
199 EXPLORER.exe
44 systray.exe
77 PROMon.exe
196 dpmw32.exe
206 nwtray.exe
217 LOADWC.exe
214 NALDESK.exe
219 STARTEAK.exe
197 EM_EXEC.exe
230 wcescomm.exe
236 OSA.exe
194 Printkey2000.ex.exe
99 CLOCK.exe
233 DDHELP.exe
245 CpqEAKSystemTra.exe
247 CPQEADM.exe
249 rundll32.exe
226 BttnServ.exe
211 OUTLOOK.exe
183 MAPISP32.exe
293 oclient.exe
279 inv.exe
288 fts.exe
340 DRWTSN32.exe
0 _Total.exe
(00400000 - 00400000)
(77f70000 - 77fd0000) dll\ntdll.dbg
(77f00000 - 77f62000) dll\kernel32.dbg
(77e70000 - 77ec5000) dll\user32.dbg
(77ed0000 - 77efc000) dll\gdi32.dbg
(77dc0000 - 77dff000) dll\advapi32.dbg
(77e10000 - 77e67000) dll\rpcrt4.dbg
(10000000 - 10000000)
(73060000 - 73078000) drv\winspool.dbg
(77d80000 - 77db3000) dll\comdlg32.dbg
(77c40000 - 77d80000) dll\shell32.dbg
(71700000 - 7178a000) COMCTL32.dbg
(78000000 - 78046000)
(00230000 - 00230000)
(77710000 - 77721000) dll\mpr.dbg
(52180000 - 5218b000) dll\version.dbg
(779b0000 - 779b8000) dll\lz32.dbg
(00270000 - 00270000)
(009b0000 - 009b0000)
(009d0000 - 00a8e000)
(70bd0000 - 70c1c000) SHLWAPI.dbg
(731b0000 - 731ba000) dll\psapi.dbg
(76ae0000 - 76afd000) dll\imagehlp.dbg
(77b80000 - 77c37000) dll\ole32.dbg
(5f300000 - 5f329000) olepro32.dbg
(65340000 - 653d5000) oleaut32.dbg
(77170000 - 77196000) dll\ddraw.dbg
(77fd0000 - 77ffb000) dll\winmm.dbg
(6bc00000 - 6bc10000) ..\..\bin\i386\free\SMNT40.dll
(69f00000 - 69fba000) ..\bin\i386\free\adisynth.dll
(01590000 - 01590000)
(015c0000 - 015c0000)
(11c00000 - 11c00000)
(016e0000 - 016e0000)
(71190000 - 71197000) dll\msidle.dbg
Statusabbild für Thread-ID 0xdc
eax=00000000 ebx=00000001 ecx=0012ffb0 edx=00000001 esi=08098005 edi=00000000
eip=009f3d84 esp=0012f21c ebp=00000001 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246
Funktion: <nosymbols>
009f3d5e 745a jz 009f3dba
009f3d60 8b9424300a0000 mov edx,[esp+0xa30] ss:0012fc4c=001f0308
009f3d67 52 push edx
009f3d68 e813600000 call 009f9d80
009f3d6d 8b8424380a0000 mov eax,[esp+0xa38] ss:0012fc54=0012fcc4
009f3d74 83c404 add esp,0x4
009f3d77 3bc5 cmp eax,ebp
009f3d79 753f jnz 009f3dba
009f3d7b 8b84243c0a0000 mov eax,[esp+0xa3c] ss:0012fc58=0012fcc0
009f3d82 8b00 mov eax,[eax] ds:00000000=????????
FEHLER ->009f3d84 39780c cmp [eax+0xc],edi ds:01c7ea06=????????
009f3d87 7531 jnz 009f3dba
009f3d89 8b4820 mov ecx,[eax+0x20] ds:01c7ea06=????????
009f3d8c 81e10000c000 and ecx,0xc00000
009f3d92 81f90000c000 cmp ecx,0xc00000
009f3d98 7520 jnz 009f3dba
009f3d9a f6402c08 test byte ptr [eax+0x2c],0x8 ds:01c7ea06=??
009f3d9e 741a jz 009f3dba
009f3da0 8b9424300a0000 mov edx,[esp+0xa30] ss:0012fc4c=001f0308
009f3da7 8b0d1800a400 mov ecx,[00a40018] ds:00a40018=01660004
009f3dad 55 push ebp
009f3dae 52 push edx
*----> Stack Back Trace <----*
FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
00000001 00000000 00000000 00000000 00000000 00000000 !<nosymbols>
*----> Raw Stack Dump <----*
0012f21c c4 fc 12 00 c0 fc 12 00 - a8 fc 12 00 00 00 00 00 ................
0012f22c 00 00 00 00 00 00 00 00 - 11 00 00 00 00 00 ca 16 ................
0012f23c 00 00 00 00 b0 ff 23 0e - f6 1c e7 77 c1 45 f0 77 ......#....w.E.w
0012f24c 07 04 00 00 00 00 00 00 - 08 f3 12 00 00 00 00 00 ................
0012f25c 04 43 a3 00 ff ff ff ff - 00 00 ca 16 3d 1b e7 77 .C..........=..w
0012f26c 6c 76 9f 00 08 f3 12 00 - 04 43 a3 00 c4 fc 12 00 lv.......C......
0012f27c c0 fc 12 00 a8 fc 12 00 - 00 00 00 00 05 80 09 08 ................
0012f28c 00 00 00 00 00 00 ca 16 - 01 03 00 00 0d 00 00 00 ................
0012f29c ff 00 00 00 78 f3 12 00 - 01 00 00 00 58 f3 12 00 ....x.......X...
0012f2ac 3f 63 00 10 08 03 1f 00 - 00 00 00 00 01 00 00 00 ?c..............
0012f2bc 00 00 00 00 01 00 00 00 - 00 00 00 00 00 00 00 00 ................
0012f2cc 48 f3 12 00 44 f3 12 00 - eb 00 00 00 cf 00 00 00 H...D...........
0012f2dc eb 00 00 00 cf 00 00 00 - 13 04 00 00 2f 03 00 00 ............/...
0012f2ec 95 00 01 00 00 00 00 00 - 00 00 00 00 44 f3 12 00 ............D...
0012f2fc 00 00 00 00 46 00 69 00 - 62 00 65 00 46 00 69 00 ....F.i.b.e.F.i.
0012f30c 62 00 65 00 72 00 20 00 - 54 00 72 00 61 00 6e 00 b.e.r. .T.r.a.n.
0012f31c 73 00 70 00 6f 00 72 00 - 74 00 20 00 53 00 79 00 s.p.o.r.t. .S.y.
0012f32c 73 00 74 00 65 00 6d 00 - 00 00 0c 00 00 00 00 00 s.t.e.m.........
0012f33c 44 f3 12 00 f0 ae 9f 00 - 1a 00 00 00 78 f3 12 00 D...........x...
0012f34c ff 00 00 00 0d 00 00 00 - 08 03 1f 00 84 fb 12 00 ................
|
|
|
|
|
First thing to do: make a release build with debug symbols enabled. Then run it in your debugger and set a breakpoint at address 009f3d68 (significant call) and then step through the next few bytes. Then you know exactly where in your source it crashes. It might not reveal the reason but the location.
Make sure your app relocates to 0x009d0000 by setting the relocation address in the linker settings. (Or just calculate the offset: your app's loadaddress + (0x009f3d68-0x009d0000) = breakpoint)
Also note the NULL return address on the stack. Your stack is gone at this point.
I don't think this is a serious possesion, and the evil most likely comes from your hand. Colin J Davies, The Lounge
|
|
|
|
|
Hi --
I have a simple question about dynamic memory and vectors:
Consider the vector class:
class vector
{
private:
int rows ;
double *vec ;
public:
vector(void) { rows=0 ; vec=0; } // default constructor
vector(int rows) // constructor
{
vec = new double[rows] ;
}
~vector(void) {} ; // destructor
} ;
when i use the class in MAIN() like:
vector* A ;
A = new vector(15) ;
I get an error. It's giving a "null reference error" and saying that the object has not been instantiated..
I don't get what I'm doing wrong?
Thanks
KBL
|
|
|
|
|
I'm confused, are you using the vector class which comes with C++, or writing your own ? A vector is a dynamic array.
You're also not deleting your double * in your destructor.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
i'm writing my own vector class, but using dynamic arrays to do it. as you say, a vector is just a dynamic array, but i thought it was nice to wrap it up in a class so i can do stuff like this in main():
vector* a = new vector(10) ;
a->sort() ;
a->rank() ;
etc..
|
|
|
|
|
KBL wrote:
but i thought it was nice to wrap it up in a class so i can do stuff like this in main():
?How disturbing. I would not do it this way, if you really want to do this I would do two things.
1. I would call it something else, so that the two never clash
2. I would contain a vector and expose the methods to do what I wanted. Then you can use the algorithms that come with the STL instead of writing your own.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
in this case i have some reasons for writing my own. i'm a mathematician/statistician trying to learn c++ (over c and fortran like languages), and i just don't know enough about the efficiency of all the stl functions. i already wrote my functions but now i wanted to wrap the whole thing up in a class.
|
|
|
|
|
The efficiency of STL functions is documented in the standard, plus you have the source code for vector, so you can look for yourself. I certainly respect the desire to write your own as a way to learn. You should make your container expose iterators so you can use the standard algorithms all the same, and you should most certainly not call it 'vector'.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
thanks, that makes alot of sense. i'll take a look at the stl functions.
do you think it's the name clash that gives me problems, or is it the second contructor. should the constructor look like this rather than what i had before (i changed the name to myvector):
myvector(int n)
{ rows=n ;
vec = new double[rows] ;
}
|
|
|
|
|
I doubt the name is the problem, it's more a potential problem. The constructor is a safer bet, the new one looks much better.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
i'll definitely rename it and change my destructor.
|
|
|
|
|
1. Where is the error occurring -- what line?
2. Did you notice that in your second constructor you don't initialize your "rows" member?
3. I recommend that you declare and initialize A in the same line: vector* A = new vector(15) ;. It's less code and it's safer.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
It's occuring the constructor. That is, in the line:
vec = new double[15] ;
|
|
|
|
|
do i need to intialize it in the second constructor when i have it as a member variable in the class?
|
|
|
|
|
so my class should be something like this
class vector
{
private:
int rows ;
double *vec ;
public:
vector(void) { rows=0 ; vec=0; } // default constructor
vector(int n) // constructor
{
rows=n ;
vec = new double[rows] ;
}
~vector(void) {delete vec} ; // destructor
} ;
|
|
|
|
|
is this how you would initialize it:
vector(int n) ;
{
rows=n ;
vec = new double[rows] ;
}
|
|
|
|