|
hehe, i'm sure it is a stack overflow... because of page fault...
you define the CDialog class local in the InitInstance function of the program, right??
then it makes no difference, if you place the whole class in stack or just the 200 doubles.
define the CDialog class GLOBAL, then it should work!
Don't try it, just do it!
|
|
|
|
|
200 doubles is not a lot of memory.
John
|
|
|
|
|
Do you have another way for me to define these numbers that would take up less space?
Instead of double?
If so let me know.
I wish I could type better ...
|
|
|
|
|
My point is that 200 doubles only takes 800 bytes of memory. Your stack is over a megabyte. So the memory allocation is insignifigant... I have programs that allocate over a gigabyte of data with no probelem. They do not put it on the stack though....
John
|
|
|
|
|
next time better take a calculator!
200*sizeof(double)=200*8=1600bytes!
Don't try it, just do it!
|
|
|
|
|
You are correct a double is 8 bytes... Anyways 1600 bytes on the stack is still not signifigant..
John
|
|
|
|
|
Alexander M,
I didn't understand what the Hell you were talking about (well maybe just a little), but it got me thinking and tried some new stuff. I just defined the array in the .cpp soure code outside of all subroutines(functions? I still don't know what to call it.) And POW, BINGO, YEEHA, WHOOPIE GOLDBERG, HOORAY! It works. Global array, and no errors!
I don't know if that is what you were trying to tell me, but we will just say it was. SO, I gave you a 5 out of 5 for helpfulness, but I would have given you a 10 if they let me.
You da bomb.
Thanks!
I wish I could type better ...
|
|
|
|
|
I am not sure that it is fixed. I think you just delayed the crash by moving the variable to a different memory location.
John
|
|
|
|
|
|
thx
Don't try it, just do it!
|
|
|
|
|
I think the only reason why that solved your problem is that if you step past the end of a global variable you are probably not going to interfere with the runtime stack. Your problem probably still exists but in a sneaky way. Try the following declare your values array as
double ValuesArray[190];
Guess what it probably will not crash your dialog this time either. Why does it not crash the dialog? It is overwriting other variables in your global data that could come back and cause your program to work in an unexpected way.
I just tested my theory and it worked. I created a dialog application and in my OnOk() function I did the following which caused a crash because I am stepping past the end of ValuesArray.
void CStackOverflowDlg::OnOK()
{
double ValuesArray[200];
for(int i=0;i < 300;i++) {
ValuesArray[i] = 100.0;
}
}
Guess what moving ValuesArray to the global namespace and there was no crash at all.
double ValuesArray[200];
void CStackOverflowDlg::OnOK()
{
for(int i=0;i < 300;i++) {
ValuesArray[i] = 100.0;
}
}
But have I fixed the problem? Absolutely NOT! I still am using more items ValuesArray than I declared...
John
|
|
|
|
|
Hi,
How to assign a new IP address through MFC for windows 98. after assigning
I should not restart the system and could be able to continue with
communication. I tried with AddIPAddress().
but this supports only winNT. Is there any equivalent api in windows 98.
thanks in advance,
pramod.
Pramod Kumar A
SASKEN-INDIA
|
|
|
|
|
Interesting. One possible solution is to change the IP via registry.
Kuphryn
|
|
|
|
|
Is there such a thing? In short, I need to hook a game that was written with DirectX...
Thanks
Ralph Krausse
|
|
|
|
|
D3DSpy from the DirectX 9 SDK.
- Mike
|
|
|
|
|
I ahve no experience in anything at all and i was wondeing if anyone could give me tips on how to start becoming a game developer?
Program newb
|
|
|
|
|
Don't shoot too high on your first attempt at a real game - don't attempt to write a Halo or a GTA:VC on your own as your first project - you will fail and get depressed Aim for something simple like Tetris.
Try out different tools to see what you are comfortable with - try Flash for some 2D games, for example.
Learn a simple and clean language such as VB.NET or C# or Python to gain programming experience with relatively little pain (which you will want to do) without getting immediately bogged down an insanely complicated but powerful language like C++ (which a lot of games are currently written in).
Learn LISP as skills development. Because you learn how to program well just as much from "odd and obscure" languages as much as "normal and popular" ones.
Try stuff out - experiment with different approaches to solving a problem.
Develop good algorithm skills - know what the operating complexity/advantages/disadvantages of an algorithm are. Your game is going to be slow if you use a bubble sort to sort the Z-Order of some polygons because you didn't bother to learn quick sort or radix sort because it looked too complicated. Knuth's Art of Computer Programming series has a lot on these algorithms - which leads to the next point:
You'll need books. Lots of books. Books covering DirectX, C++, object oriented design, software testing, dealing with people on software teams (you did plan on working with others, right?), and probably books on VB.NET/C#/Python to help writing your toolsets with (level designers, scripting, etc - you want something quick, dirty and productive for these)
Don't be impatient. It takes years to become a talented and skilled developer.
Ask sensible, concise and thought-out questions in the appropriate forums (here and elsewhere). (Note, your question isn't one of them It's too broad in scope.)
BTW, I'm not a games developer, just a highly skilled "normal" developer.
--
Ian Darling
|
|
|
|
|
I found writing a PACMAN game is a good starter...
John
|
|
|
|
|
Do you have any programming experience at all?
If you have none, then the first thing to do is learn a language. Start simple and learn the basics of your chosen language before even contemplating writing a game.
If you do have some coding experience then http://gamedev.net[^] is a good resource for learning about game development.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
Is it possible to set a few check buttons to be defaultly true so that when a user opens an applcation those buttons are by default true??
if it is how can we do that??
|
|
|
|
|
Try calling
CButton::SetCheck() in OnInitDialog() of your dialog class.
|
|
|
|
|
There is no window style to set to get your checkboxes set initially.
e.g. No BS_CHECKEDALREADY.
But its not hard to do this for yourself. If you use classwizard / DDX_Check,
just make sure your m_bAlreadySet = TRUE in your dialog constructor.
Or check the box manually in your OnInitDialog routine.
The possibilities may not be endless, but they are pretty large.
Iain
|
|
|
|
|
can u please give me exact code if I use class wizard /DDX_check?
I tried to declare a variable called m_Alreadyset to my check button of type BOOL and set it to true in OninitDialog, but it didn't work.
|
|
|
|
|
Hi,
Setting the BOOL variable to TRUE will work only before! a call to DoDataEcxhange.
So you must set your variable to TRUE before the line CDialog::OnInitialUpdate();
or call UpdateData(false); at the end of your OnInitialUpdate-Routine.
You may also consider doing the assignment in your dialog's constructor.
Regards
G. Steudtel
|
|
|
|
|
You'll need a member variable mapped to each of the checkboxes. Then in OnInitDialog() , simply call the SetCheck() method of each member variable.
m_checkbox1.SetCheck(BST_CHECKED);
m_checkbox2.SetCheck(BST_UNCHECKED);
m_checkbox3.SetCheck(BST_CHECKED);
...
|
|
|
|