Click here to Skip to main content
15,914,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How do you convert a CString to a char *? Pin
Garth J Lancaster21-Jul-08 16:32
professionalGarth J Lancaster21-Jul-08 16:32 
AnswerRe: How do you convert a CString to a char *? Pin
kDevloper21-Jul-08 19:04
kDevloper21-Jul-08 19:04 
GeneralRe: How do you convert a CString to a char *? Pin
CPallini21-Jul-08 21:17
mveCPallini21-Jul-08 21:17 
GeneralRe: How do you convert a CString to a char *? Pin
kDevloper22-Jul-08 0:41
kDevloper22-Jul-08 0:41 
GeneralRe: How do you convert a CString to a char *? Pin
CPallini22-Jul-08 5:02
mveCPallini22-Jul-08 5:02 
AnswerRe: How do you convert a CString to a char *? Pin
Michael Dunn22-Jul-08 13:43
sitebuilderMichael Dunn22-Jul-08 13:43 
Questionneed to access the dictionary installed in word pad or MSword.olb to create a word game utilizing c++ Pin
DB Ed21-Jul-08 12:12
DB Ed21-Jul-08 12:12 
QuestionIs it possible to attach another apps' window DC? (About Gdi handle table and objects) Pin
sawerr21-Jul-08 9:05
sawerr21-Jul-08 9:05 
Hi
I want to make a program that retrieves other windows' pixel values. First i made a default application which title name is "Untitled - NewWindow" and one more MFC project which is trying to draw to that window.

The code is:

void CDeviceContextDlg::OnBnClickedButton1()
{
	::EnumWindows(EnumWindowsProc, NULL);	
}


BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
	if(hwnd == FindWindow(NULL,L"Untitled - NewWindow"))
	{
		HDC dc = GetDC(hwnd);
		CDeviceContextDlg *dlg = (CDeviceContextDlg *)AfxGetMainWnd();
		if((dlg->Clientdc.Attach(dc)))
		{
			dlg->Clientdc.SetBkColor(RGB(255,0,0));
			
		};
	};
	return TRUE;
}


It gives run-time error. I debugged it and in that line:
HDC dc = GetDC(hwnd);

In Debugger:

dc	0x53011041 {unused=??? }	HDC__ *
unused	CXX0030: Error: expression cannot be evaluated	


Is it because process gdi handle table is process specific and it is impossible to get DC and draw another process' window?

Or is there a way to draw another process' window or getpixel values?
Thanks
AnswerRe: Is it possible to attach another apps' window DC? (About Gdi handle table and objects) Pin
CPallini21-Jul-08 9:25
mveCPallini21-Jul-08 9:25 
GeneralRe: Is it possible to attach another apps' window DC? (About Gdi handle table and objects) Pin
Rajesh R Subramanian22-Jul-08 23:34
professionalRajesh R Subramanian22-Jul-08 23:34 
GeneralRe: Is it possible to attach another apps' window DC? (About Gdi handle table and objects) Pin
CPallini22-Jul-08 23:41
mveCPallini22-Jul-08 23:41 
GeneralRe: Is it possible to attach another apps' window DC? (About Gdi handle table and objects) Pin
Rajesh R Subramanian22-Jul-08 23:43
professionalRajesh R Subramanian22-Jul-08 23:43 
GeneralRe: Is it possible to attach another apps' window DC? (About Gdi handle table and objects) Pin
CPallini22-Jul-08 23:48
mveCPallini22-Jul-08 23:48 
GeneralTHHB hits again Pin
Rajesh R Subramanian22-Jul-08 23:52
professionalRajesh R Subramanian22-Jul-08 23:52 
AnswerRe: Is it possible to attach another apps' window DC? (About Gdi handle table and objects) Pin
Mark Salsbery21-Jul-08 11:17
Mark Salsbery21-Jul-08 11:17 
GeneralRe: Is it possible to attach another apps' window DC? (About Gdi handle table and objects) Pin
sawerr21-Jul-08 14:11
sawerr21-Jul-08 14:11 
GeneralPercent Progress Bar Pin
robertaallan21-Jul-08 9:03
robertaallan21-Jul-08 9:03 
GeneralRe: Percent Progress Bar Pin
Randor 21-Jul-08 9:50
professional Randor 21-Jul-08 9:50 
QuestionRe: Percent Progress Bar Pin
David Crow22-Jul-08 2:52
David Crow22-Jul-08 2:52 
QuestionTab Control/Dialog Box Position problem Pin
Leslie Sanford21-Jul-08 7:47
Leslie Sanford21-Jul-08 7:47 
AnswerRe: Tab Control/Dialog Box Position problem Pin
Randor 21-Jul-08 8:20
professional Randor 21-Jul-08 8:20 
AnswerRe: Tab Control/Dialog Box Position problem Pin
Mark Salsbery21-Jul-08 8:54
Mark Salsbery21-Jul-08 8:54 
GeneralRe: Tab Control/Dialog Box Position problem Pin
Leslie Sanford21-Jul-08 8:56
Leslie Sanford21-Jul-08 8:56 
QuestionHow to print on a non-default printer without print dialog Pin
victoria195021-Jul-08 6:29
victoria195021-Jul-08 6:29 
QuestionExtending a class that uses a template Pin
Patrick G21-Jul-08 5:55
Patrick G21-Jul-08 5:55 

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.