int Initialize_DirectDraw(HWND hWnd, HINSTANCE hInstance)
{
CDDW *pDirectDraw = new CDDW(hWnd);
return (TRUE);
}
local pointers to objects
I have a class called CDDW (class direct draw wrapper) and i want to initialize it in a global function called Initialize_DirectDraw()..Now the problem is, if i initialize it like this:
then im getting a memory leak..I want the cpp files dealing with graphics and the ones on initialization and closing to have access to the pointer...how would i go about making the pointer global? Or am i doing something entirely wrong?
EDIT: fixing tags
[edited by - laroche on May 27, 2002 3:13:16 PM]
Check out my music at: http://zed.cbc.ca/go.ZeD?user_id=41947&user=Laroche&page=content
Are you calling delete on pDirectDraw after you finish with it? If not that''s probably the problem.
delete pdirectDraw;
is how you would do that.
delete pdirectDraw;
is how you would do that.
But if i delete it in the function how would i use it in the other .CPP files in the rest of my program?
Check out my music at: http://zed.cbc.ca/go.ZeD?user_id=41947&user=Laroche&page=content
Instead of a function calling Initialize_DirectDraw, it could simply create a new CDDW;. The pointer could be passed to the functions / classes that need it, and can be deleted once you''re finished with it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement