Click here to Skip to main content
15,902,891 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Real code? Pin
tmasm27-Dec-02 5:02
tmasm27-Dec-02 5:02 
GeneralRe: Memory Leak with MSXML3 Pin
Navin27-Dec-02 7:01
Navin27-Dec-02 7:01 
GeneralCustomization of Build Pin
gracias_carol27-Dec-02 1:58
gracias_carol27-Dec-02 1:58 
GeneralWhat kind of customization? Pin
AlexO27-Dec-02 4:04
AlexO27-Dec-02 4:04 
GeneralRe: What kind of customization? Pin
gracias_carol29-Dec-02 23:07
gracias_carol29-Dec-02 23:07 
Generalifstream and skipws Pin
georgiek5027-Dec-02 1:15
georgiek5027-Dec-02 1:15 
GeneralRe: ifstream and skipws Pin
Taka Muraoka27-Dec-02 1:24
Taka Muraoka27-Dec-02 1:24 
GeneralHelp me to Release Resources! Pin
HellShrimp4free27-Dec-02 0:23
HellShrimp4free27-Dec-02 0:23 
hi i want to help me to release the graphical recources and the Device context in the code below
Unsure | :~


CFont cf;<br />
  	    cf.CreateFont(16,0,0,0,FW_BOLD|FW_EXTRALIGHT,0,0,0,DEFAULT_CHARSET,OUT_CHARACTER_PRECIS,CLIP_CHARACTER_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_DONTCARE,"Arial");<br />
<br />
		CBitmap b;<br />
		b.LoadBitmap(IDB_BITMAP1);<br />
<br />
		BITMAP bm;<br />
		b.GetObject(sizeof(BITMAP),&bm);<br />
<br />
	        CClientDC h(cw[n]);<br />
			<br />
		CDC *dc=new CDC;<br />
		dc->CreateCompatibleDC(&h);<br />
		dc->SelectObject(&b);<br />
        				<br />
		h.SetTextColor(RGB(10,50,220));<br />
		h.SelectObject(cf);<br />
		<br />
<br />
		h.BitBlt(0,0,bm.bmWidth,bm.bmHeight,dc,0,0,SRCAND);<br />
		dc->DrawText(Int2CString(cw_key[n]),CRect(2,5,25,25),DT_CENTER);<br />
		h.BitBlt(0,0,bm.bmWidth,bm.bmHeight,dc,0,0,SRCAND);<br />
						<br />


i write this below code to release them but it seems that i forget something to release .because program will become very Slow after 1 or 2 mintue. Confused | :confused:

cf.DeleteObject();<br />
		b.DeleteObject();<br />
		dc->DeleteDC();

when i write : h.DeleteDC(); an error will Occure --> Unhandled exception at 0x77f767cd in MASTER.exe.
i dunno why.

thanks for your help
GeneralRe: Help me to Release Resources! Pin
Mike Nordell27-Dec-02 1:05
Mike Nordell27-Dec-02 1:05 
GeneralGlobals and condition compilation Pin
georgiek5026-Dec-02 22:39
georgiek5026-Dec-02 22:39 
GeneralRe: Globals and condition compilation Pin
Roger Allen27-Dec-02 0:05
Roger Allen27-Dec-02 0:05 
GeneralRe: Globals and condition compilation Pin
georgiek5027-Dec-02 1:14
georgiek5027-Dec-02 1:14 
GeneralMemory Address Interpretation Pin
Dominik Reichl26-Dec-02 22:20
Dominik Reichl26-Dec-02 22:20 
GeneralRe: Memory Address Interpretation Pin
Joaquín M López Muñoz26-Dec-02 22:34
Joaquín M López Muñoz26-Dec-02 22:34 
GeneralRe: Memory Address Interpretation Pin
Dominik Reichl27-Dec-02 0:29
Dominik Reichl27-Dec-02 0:29 
GeneralRe: Memory Address Interpretation Pin
Mike Nordell27-Dec-02 1:12
Mike Nordell27-Dec-02 1:12 
GeneralRe: Memory Address Interpretation Pin
Dominik Reichl27-Dec-02 3:43
Dominik Reichl27-Dec-02 3:43 
GeneralGetView FROM OnNewDoucment() Pin
Hockey26-Dec-02 22:08
Hockey26-Dec-02 22:08 
GeneralRe: GetView FROM OnNewDoucment() Pin
super26-Dec-02 22:17
professionalsuper26-Dec-02 22:17 
GeneralRe: GetView FROM OnNewDoucment() Pin
pba_27-Dec-02 8:06
pba_27-Dec-02 8:06 
Generalhandling multiple frame windows Pin
Thanh Ly26-Dec-02 21:31
Thanh Ly26-Dec-02 21:31 
GeneralRe: handling multiple frame windows Pin
Joaquín M López Muñoz26-Dec-02 21:39
Joaquín M López Muñoz26-Dec-02 21:39 
GeneralRe: handling multiple frame windows Pin
Thanh Ly26-Dec-02 21:47
Thanh Ly26-Dec-02 21:47 
QuestionHow to define the full path of my application Pin
julych26-Dec-02 20:14
julych26-Dec-02 20:14 
AnswerRe: How to define the full path of my application Pin
Joaquín M López Muñoz26-Dec-02 20:22
Joaquín M López Muñoz26-Dec-02 20:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.