void CZRSCapDlg::StartScreen()
{
DWORD ThreadID;
hThread=CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFunc, this, 0, &ThreadID);
}
//线程
UINT WINAPI CZRSCapDlg::ThreadFunc(LPVOID pParam)
{
CZRSCapDlg *pDlg = (CZRSCapDlg *)pParam;//使用pDlg引用全局的变量或函数,这些变量和函数最好的独有使用
}
本人的使用:
UINT WINAPI CZRSCapDlg::ThreadFunc(LPVOID pParam)
{
CZRSCapDlg *pDlg = (CZRSCapDlg *)pParam;
int yuv,mp4;
av_register_all();
avdevice_register_all();
char* yuvName = NULL;
char* mp4Name = NULL;
if(pDlg->m_Order == "orderStart")
{
CString strDir,strName;
strDir = pDlg->m_filePath;
if(strDir.Right(1) != "\\")
strDir += "\\";
strDir = strDir + pDlg->m_StudentID;
pDlg->m_StudentMP4Name = strDir;
if (!PathIsDirectory(strDir))
{
CreateDirectory(strDir, 0);//不存在则创建
}
strDir += "\\";
std::vector<CString> fileList;
CFileFind f;