For the class parameter the documentation says a redefined name (not sure what that means) the reason I am asking I am using a control for which I have a specific WNDCLASS which I registered however the CDialog::Create fails with that control statement in the resource definition
As Richard said, we need more information:
- what is "the class parameter"?
- what is "the documentation" you are referring to?
- what is "the CDialog::Create"?
- also: in what way does it "fail"? Is there a compiler, linker or run-time error, and what does it say? Or does you program not behave in the expected way - if so, how, and what did you expect?
You are apparently referring to very specific things, but we have no idea what you're seeing or reading. (or whether that is relevant information to start with)
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
can it be my own class which I register at run time via RegesterClass
I am not sure as I have never tried that. The documentation at CONTROL control - Win32 apps | Microsoft Docs[^] states (although it is slightly ambiguous) that it must be one of the predefined classes. If your code is failing when you try it with a locally defined class then you need to use the debugger to find out why.
I think the documentation means you have to Register the Class before calling CDialog::Create as I remember I forgot to call AfxInitRichEdit before doing a CDialog::Create and it failed I think CDialog::Create Checks Uid template dialog resource and sees if the classes are registered
I've never tried it so I'm not sure exactly how it works but I notice a rather strange capitalization in you class name: "PieCOntrol". I don't know if Windows is case sensitive or not when looking for class name.
Thanks that’s they way I had it in my wndclass I am displaying a pie chart on the side of a dialog box but need a Cwnd class to hang it off of thats the class I’m using for it used the cpiedemo from this site for learning
It would be easier to look at your code if it was formatted. However, it isn't obvious to me what's causing your stack overflow. Do you have more code that you're not showing?
A stack overflow is caused by too much function call nesting (perhaps because of recursion), too many local variables (usually large arrays), or creating a thread with a smaller stack than it needs (that's the second parameter to CreateThread, and since you're using 0, you're getting Windows' default size, which should be OK).
If there's a compiler option to generate a listing file, that might contain the information. I've never done this in Windows C++, so you'd have to look into it.
Another way would be to do this at the top of your function:
// rest of local variables
int size = &last - &first; // distance from first to last local variable
if(size <0) size = -size; // depends on how compiler lays out memory
size -= sizeof(int); // the real size after removing FIRST and LAST
cout <<"This function's locals use "<< size <<" bytes."<<std::endl;