Click here to Skip to main content
16,007,443 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: string and xstring Pin
CPallini28-Dec-07 5:05
mveCPallini28-Dec-07 5:05 
GeneralRe: string and xstring Pin
Maxwell Chen28-Dec-07 5:07
Maxwell Chen28-Dec-07 5:07 
GeneralRe: string and xstring Pin
CPallini28-Dec-07 5:13
mveCPallini28-Dec-07 5:13 
GeneralRe: string and xstring Pin
Maxwell Chen28-Dec-07 5:18
Maxwell Chen28-Dec-07 5:18 
GeneralRe: string and xstring Pin
CPallini28-Dec-07 5:36
mveCPallini28-Dec-07 5:36 
GeneralRe: string and xstring Pin
Maxwell Chen28-Dec-07 5:48
Maxwell Chen28-Dec-07 5:48 
GeneralRe: string and xstring Pin
Maxwell Chen2-Jan-08 1:02
Maxwell Chen2-Jan-08 1:02 
General(Solved) GDI+ and CDC::GetWindow() Pin
bob1697228-Dec-07 4:00
bob1697228-Dec-07 4:00 
(Update: Problem solved)

I'm trying to use CDC::GetWindow to get a pointer to a CWnd object to perform some tests but CDC::GetWindow() returns NULL. I'm trying to derive the CDC from the Graphics object passed into a function as follows...

void SomeFunction(Graphics& graphics)
{
	HDC hDC=graphics.GetHDC();
	CDC* pDC=CDC::FromHandle(hDC);

	if (pDC) {

		CWnd* pWnd=pDC->GetWindow();
		if (pWnd) {

			// Never gets here
		}
	}

	graphics.ReleaseHDC(hDC);
}

Can anyone tell me the folly of my ways?
thanks in advance

modified on Friday, December 28, 2007 11:17:40 AM

QuestionRe: GDI+ and CDC::GetWindow() Pin
CPallini28-Dec-07 4:46
mveCPallini28-Dec-07 4:46 
GeneralRe: GDI+ and CDC::GetWindow() Pin
bob1697228-Dec-07 5:03
bob1697228-Dec-07 5:03 
GeneralRe: GDI+ and CDC::GetWindow() Pin
CPallini28-Dec-07 5:08
mveCPallini28-Dec-07 5:08 
GeneralRe: GDI+ and CDC::GetWindow() Pin
bob1697228-Dec-07 5:17
bob1697228-Dec-07 5:17 
GeneralRe: GDI+ and CDC::GetWindow() Pin
bob1697228-Dec-07 5:29
bob1697228-Dec-07 5:29 
GeneralRe: GDI+ and CDC::GetWindow() Pin
CPallini28-Dec-07 5:44
mveCPallini28-Dec-07 5:44 
QuestionRe: GDI+ and CDC::GetWindow() Pin
Hamid_RT28-Dec-07 4:50
Hamid_RT28-Dec-07 4:50 
GeneralRe: GDI+ and CDC::GetWindow() Pin
bob1697228-Dec-07 5:06
bob1697228-Dec-07 5:06 
GeneralRe: GDI+ and CDC::GetWindow() Pin
bob1697228-Dec-07 5:18
bob1697228-Dec-07 5:18 
GeneralOff-topic: Happy new year Pin
CPallini1-Jan-08 3:38
mveCPallini1-Jan-08 3:38 
Questioncan anybody tell me What happens if an exception is throws from an, object's constructor and object's destructor? Pin
philiptabraham28-Dec-07 1:49
philiptabraham28-Dec-07 1:49 
AnswerRe: can anybody tell me What happens if an exception is throws from an, object's constructor and object's destructor? Pin
CPallini28-Dec-07 2:12
mveCPallini28-Dec-07 2:12 
AnswerRe: can anybody tell me What happens if an exception is throws from an, object's constructor and object's destructor? Pin
peterchen28-Dec-07 2:27
peterchen28-Dec-07 2:27 
Generallinked list Pin
LiYS28-Dec-07 1:04
LiYS28-Dec-07 1:04 
QuestionRe: linked list Pin
CPallini28-Dec-07 1:10
mveCPallini28-Dec-07 1:10 
GeneralRe: linked list Pin
Naveen28-Dec-07 1:43
Naveen28-Dec-07 1:43 
GeneralRe: linked list Pin
Nishad S28-Dec-07 2:31
Nishad S28-Dec-07 2:31 

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.