win32 help needed!!
hiya fellow programmers.. am working on a program that draws a square on the screen, in windows. It''s supposed to keep drawing the square in a loop but the loop isn''t even gone through once by my program. Here''s how I did it:
bool done = FALSE, drawsquare = FALSE;
void winmain(yadda yadda yadda)
{
initsomestuff;
initsomestuff;
initsomestuff;
initsomestuff;
hwnd = CreateWindow(
yadda yadda);
CreateDialog(yadda);
while(!done)
{
if(peekmsg(stuff))
dispatch, etc();
else if(drawsquare) //and I am positive this is working, it''s just not looping.
{
drawsquare(); //THIS IS THE PROBLEM, RIGHT HERE.
etc etc.
}
}
}
LRESULT CALLBACK windowstuff (yadda)
{
switch(message))
{
blah!
}
}
LRESULT CALLBACK dialogstuff (yadda)
{
switch(message)
{
case IDD_BEGINSQUARE:
drawsquare = TRUE;
break;
case WM_DESTROY:
enddialog();
PostQuitMessage(0);
}
}
now this is just alot of psuedo code half translated to C++ When I click the drawsquare button, it''s supposed to
keep drawing the square, every frame. but it doesn''t even draw it once. When I put the drawsquare() call directly after the case IDD_DRAWSQUARE: it draws it once so I know that my drawsquare function is uhhhh functioning.
Thanks for your time, any help will be appreciated.
-Chazz
Maybe the way how you use the IDD_BEGINSQUARE is wrong.
If this supposed to catch a button click you might want to try:
And you must give the button the ID_BEGIN name.
(ps: Just wish we had a nice New Win32 Forum for problems like these )
If this supposed to catch a button click you might want to try:
BOOL CALLBACK DlgProcStuff(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch(uMsg) { case WM_INITDIALOG: { return TRUE; } case WM_COMMAND: switch(LOWORD(wParam)) //HIWORD(wParam)==BN_CLICKED { case ID_BEGIN: drawsquare = TRUE; return 0; } break; } return FALSE;}
And you must give the button the ID_BEGIN name.
(ps: Just wish we had a nice New Win32 Forum for problems like these )
Ok, thanks for replying but I don''t think you read my post clearly:
"When I click the drawsquare button, it''s supposed to
keep drawing the square, every frame. but it doesn''t even draw it once. When I put the drawsquare() call directly after the case IDD_DRAWSQUARE: it draws it once so I know that my drawsquare function is uhhhh functioning."
I also stated that I have presented readers with psuedo code, not the actual code (and I did it off the top of my head). My buttons work.
I figured out this problem but now another has arised.
How do I loop with dialog boxes?? any sites?
"When I click the drawsquare button, it''s supposed to
keep drawing the square, every frame. but it doesn''t even draw it once. When I put the drawsquare() call directly after the case IDD_DRAWSQUARE: it draws it once so I know that my drawsquare function is uhhhh functioning."
I also stated that I have presented readers with psuedo code, not the actual code (and I did it off the top of my head). My buttons work.
I figured out this problem but now another has arised.
How do I loop with dialog boxes?? any sites?
-Chazz
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement