
Posted:
Apr 21, 2002 @ 5:23pm
by Johan
Hi,
The issues are in you C++ code. You should not delete objects which are instantiated on the stack.
So. Just remove the following rows and the code should work correctly:
// Remove these lines:
delete &gd_S1;
delete &gd_Backbuffer;
delete &gd_Display;
// End of line removal
Best regards,
Johan
re: What is wrong with this piece of code? -- New try

Posted:
Apr 21, 2002 @ 9:30pm
by efortier
Hello, and thanks for your reply!
I tried what you mentionned and it still doesn't work. So I created a new PocketPC 2002 project, and added only these lines to a menu message handler:
case ID_mnuGapiDraw:
{
HRESULT cRes = GD_OK;
CGapiDisplay gd_Display;
cRes = gd_Display.OpenDisplay(hWnd, GDOPENDISPLAY_FULLSCREEN );
if(cRes != GD_OK)
{
ShowErr(1,cRes,hWnd);
break;
}
cRes = gd_Display.SetDisplayMode(GDDISPMODE_NORMAL);
if(cRes != GD_OK)
{
ShowErr(2,cRes,hWnd);
break;
}
break;
}
On the first try, all works correctly. The second time I click on the menu, the SetDisplayMode return the PRIMARYSURFACEALREADYEXISTS error message.
Are there any restrictions to when and where GapiDraw should be used?
There's so little code that I don't know what I'm doing wrong. My PC runs Windows 2000 with the eVC distribution, and my portable is an iPAQ 3850 with no add-ons.
Thanks for any other infos. Sorry for the lack of tabs or spaces. The forums removed them...