VS2005 MFC dialog box global function access member variable __ function

Source: Internet
Author: User

A few days ago to do a program, to achieve real-time video display, and real-time capture, using multithreading. and multithreaded function in order to access the dialog box member variables, compile without errors, but run terminated, prompt

Debug Assertion failed!

File:f:\rtm\vctools\vc7libs\ship\atlmfc\src\mfc\winocc.cpp

To discover the problem of calling class members in thread functions

Refer to this article click Open link

The solution is to declare a global variable void *pdlg first;

dialog box to add Pdlg=this to the initial function;

Functional functions for threads

void Thread1videofunc ()
{
while (1)
{
Cmfc_videodlg *maindlg;
maindlg= (cmfc_videodlg*) Pdlg;
Maindlg->m_showvideo=cvqueryframe (Capture);
MAINDLG->DRAWPICTOHDC (Maindlg->m_showvideo,idc_picture_video);
Sleep (100);
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.