Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Win32API/MFC to capture desktop as an image [modified] Pin
Adam Roderick J30-Jul-09 0:31
Adam Roderick J30-Jul-09 0:31 
GeneralRe: Win32API/MFC to capture desktop as an image Pin
Madhu_Rani30-Jul-09 1:59
Madhu_Rani30-Jul-09 1:59 
GeneralRe: Win32API/MFC to capture desktop as an image Pin
Madhu_Rani30-Jul-09 2:05
Madhu_Rani30-Jul-09 2:05 
GeneralRe: Win32API/MFC to capture desktop as an image Pin
Asharudeed16-Feb-10 4:23
Asharudeed16-Feb-10 4:23 
QuestionemBDA.sys BSOD!!! [modified] Pin
Kiran Satish29-Jul-09 19:00
Kiran Satish29-Jul-09 19:00 
QuestionCRect Pin
kumar sanghvi29-Jul-09 18:45
kumar sanghvi29-Jul-09 18:45 
Questionhow to convert the matlab left matrix division \ into cv++ with opencv? Pin
DevelopmentNoob29-Jul-09 16:23
DevelopmentNoob29-Jul-09 16:23 
Question"Assertion Failed" with thread and device context Pin
nautilusvn29-Jul-09 16:11
nautilusvn29-Jul-09 16:11 
Hi all,

I write a MFC program that will execute a drawing circle in another thread when I click on somewhere in client area and I got it.

My problem is when I click various time (and quickly) it sometime gives me an "Assertion Failed" error.

here is my code:
void CGSimView::OnLButtonDown(UINT nFlags, CPoint point) 
{
        ...
	DCPOINT info;
	PTPOINT3D currentPoint = pDoc->m_graph.GetNode(point.x,point.y);
	
	if(currentPoint != NULL)
	{
		this->m_nodeIndex = currentPoint->index;

		info.hwnd = this->GetSafeHwnd();
		this->GetClientRect(&info.rect);
		info.point = currentPoint;

		AfxBeginThread(onGetFocus,&info);
	}
	
	
	CView::OnLButtonDown(nFlags, point);
}

UINT onGetFocus(LPVOID param)
{

	DCPOINT *info = (DCPOINT*)param;

	HDC hdc = GetDC(info->hwnd);
		
	PTPOINT3D p = info->point;
	int i, temp;
	CRect rect = info->rect;
	HPEN hPen, hOldPen;

	hPen = CreatePen(PS_SOLID,1,RGB(225,0,0));

	hOldPen = (HPEN)SelectObject(hdc, hPen);

	for(i=0;i<9;i++)
	{
		temp = 10+i;
		Ellipse(hdc,p->x - temp,p->y - temp,p->x + temp, p->y + temp);
		Sleep(10);
	}

	SelectObject(hdc, hOldPen);
	DeleteObject(hPen);

	return 0;
}


please help me to solve this.
Thank in advance.
AnswerRe: "Assertion Failed" with thread and device context Pin
Richard Andrew x6429-Jul-09 16:51
professionalRichard Andrew x6429-Jul-09 16:51 
GeneralRe: "Assertion Failed" with thread and device context Pin
nautilusvn29-Jul-09 17:25
nautilusvn29-Jul-09 17:25 
GeneralRe: "Assertion Failed" with thread and device context Pin
Richard Andrew x6429-Jul-09 17:31
professionalRichard Andrew x6429-Jul-09 17:31 
GeneralRe: "Assertion Failed" with thread and device context Pin
Richard Andrew x6429-Jul-09 17:35
professionalRichard Andrew x6429-Jul-09 17:35 
GeneralRe: "Assertion Failed" with thread and device context Pin
nautilusvn29-Jul-09 20:27
nautilusvn29-Jul-09 20:27 
GeneralRe: "Assertion Failed" with thread and device context Pin
Richard Andrew x6430-Jul-09 4:14
professionalRichard Andrew x6430-Jul-09 4:14 
AnswerRe: "Assertion Failed" with thread and device context Pin
krmed30-Jul-09 6:53
krmed30-Jul-09 6:53 
QuestionPassing multi-dimensional array from C# to Win32 C++ dll? [modified] [MOVED TO C++/CLI] Pin
devvvy29-Jul-09 16:03
devvvy29-Jul-09 16:03 
AnswerRe: Passing multi-dimensional array from C# to Win32 C++ dll? Pin
Richard Andrew x6429-Jul-09 16:48
professionalRichard Andrew x6429-Jul-09 16:48 
Questionerror C1083 Pin
shabbychic29-Jul-09 15:57
shabbychic29-Jul-09 15:57 
AnswerRe: error C1083 Pin
Richard Andrew x6429-Jul-09 16:47
professionalRichard Andrew x6429-Jul-09 16:47 
Questionhow to link a radio button to a command button? (mfc c++) Pin
Neil Jigger29-Jul-09 15:06
Neil Jigger29-Jul-09 15:06 
AnswerRe: how to link a radio button to a command button? (mfc c++) Pin
Richard Andrew x6429-Jul-09 15:45
professionalRichard Andrew x6429-Jul-09 15:45 
GeneralRe: how to link a radio button to a command button? (mfc c++) Pin
Neil Jigger29-Jul-09 15:48
Neil Jigger29-Jul-09 15:48 
GeneralRe: how to link a radio button to a command button? (mfc c++) Pin
Richard Andrew x6429-Jul-09 16:00
professionalRichard Andrew x6429-Jul-09 16:00 
GeneralRe: how to link a radio button to a command button? (mfc c++) Pin
Neil Jigger29-Jul-09 16:08
Neil Jigger29-Jul-09 16:08 
GeneralRe: how to link a radio button to a command button? (mfc c++) Pin
Richard Andrew x6429-Jul-09 16:13
professionalRichard Andrew x6429-Jul-09 16:13 

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.