🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Dlg & Stack Fault

Started by
8 comments, last by Enix 24 years, 5 months ago
Im making a level editor for a game called Graal. Now in this level editor first i create a "project" and i use a dialog box to do this. later on i want to create a "room" and i use another dialog box to do this, except that when this DialogBox is created, i alwas get a Stack Fault in my program message from windows. Next i hit debug and VC tells me there has been a stack overflow, and then gives me a hex adress like 0xC000007D. Then it shows me some dissassembly which helps me not. After this happens about 3 times i must restart my computer becuase windows runs out of memory. I have tried changing every thing about this dialog, when it is create, modal or modeless, which dialog it is creating, everything i can think of, but I can't fix it.Could somebody please help me, it would be greatly appreciated! Edited by - Enix on 1/28/00 9:34:15 AM Edited by - Enix on 1/28/00 9:43:48 AM Edited by - Enix on 1/28/00 9:58:16 AM
Advertisement
Could someone please help me, ive been stuck on this for quite a while.
The exact message i get is(Greaditor is the name of my program):

GREADITOR caused a stack fault in module GREADITOR.EXE at 015f:0040cc94.
Registers:
EAX=00572018 CS=015f EIP=0040cc94 EFLGS=00010212
EBX=00572072 SS=0167 ESP=00572018 EBP=00572020
ECX=00571fdc DS=0167 ESI=00008096 FS=6dcf
EDX=000080b2 ES=0167 EDI=00572028 GS=afdf
Bytes at CS:EIP:
85 01 8b e1 8b 08 8b 40 04 50 c3 cc 55 8b ec 53
Stack dump:
00000000 0040c26d 00572040 bff7363b 00000e04 00000030 00000110 00000000 8070afe7 00000167 00572054 bff942e7 afdf8096 0000afdf 00000000 bff719b8
When i hit Debug, VC says:

Unhandled exception in Greaditor.exe: 0xC00000FD: Stack Overflow.
Sounds like a memory access problem to me, hm.
(null pointer access, perhaps, 0xC00000FD is very near to 0x0 )

Did you ever try to run your program in debug mode from beginning on ? Then you could watch the variables or functions you call before opening the second Dlg-Box. You could also try to simply open a default MsgWindow( if that works than your dialog should too)

Some words about the stack: In general a stack overflow occurs when you have very big local variables and recursion. Perhaps you could check this.

Sorry if I couldn''t help
NextS
Thanks for answering, im pretty sure the problem is not a NULL pointer, as im not using any pointers in the section of code that is causing me problems. I think the problem must be recursion.
The problem was recursion, and do you know whos fault it was?? Microsofts!!!!!!!!! They created the mot evil function in existence: DefDlgProc!!!!!!!! One would think it would be worth using, but all it does is take paremeters, and pass them back to the original DialogProc. This dialog proc is probably instructed to pass unkonw parems to DefDlgProc, like one does with DefWindowProc. This however creates an infinite loop with my proc give DefDlgProc messages, and DefDlgProc, sending them back only to recieve them again. This is the most stupid function i have EVER seen. it is like create this wonderfull function:

void StupidFunct()
{
while(1);
}

And microsoft make billions of dollars for Windows, with functions even a total imbasel could create!!!!!!!!!!!!!!
Yeah. Obviously. Someone who can''t watch the call stack and immediately know a recursive stack fault is occuring is claiming Windows is programmed by imbeciles. Look in the mirror.

You''re not supposed to call DefDlgProc yourself.

DefDlgProc works like this:

DefDlgProc()
{
if(!DialogProc())
{
// Message not handled, do it ourselves.
}
}

The return code of your dialogproc indicates if you handled the message yourself.

I suggest you read Charles Petzold''s "Programming Windows", it describes all of this rather well.
Fine then, windows'' functions are named and documented by imbasels.

This topic is closed to new replies.

Advertisement