zoukankan      html  css  js  c++  java
  • C++ AfxBeginThread1

     

    9*9乘法口诀

     

    关键点

     

     

    实现过程

     

     

    class CMfc01Dlg : public CDialog
    {
        // Construction
    public:
        CMfc01Dlg(CWnd* pParent = NULL);    // standard constructor
        CWinThread *m_mulProc;
        // Dialog Data
        //{{AFX_DATA(CMfc01Dlg)
        
        
        UINT mulProc(LPVOID pParam)
        {
            CMfc01Dlg *pDlg=(CMfc01Dlg*)pParam;
            
            char pszText[128]={0};
            char pszFormat[128]={0};
            
            for (int i=1;i<10;i++)
            {
                memset(pszText,0,128);
                for (int j=1;j<i+1;j++)
                {
                    wsprintf(pszFormat,"%d *%d=%-3d",i,j,i*j);
                    strcat(pszText,pszFormat);        
                }
                pDlg->m_listbox1.AddString(pszText);
            }
            return 0;
        }
        
        void CMfc01Dlg::OnButton1() 
        {
            // TODO: Add your control notification handler code here
            m_mulProc=AfxBeginThread(mulProc,this,0,0,0,NULL); 
        }
        
    void CMfc01Dlg::OnClose() 
    {
        // TODO: Add your message handler code here and/or call default
        if (mulProc!=NULL)
        {
            DWORD dwExit=0;
            BOOL bRet=GetExitCodeThread(m_mulProc->m_hThread,&dwExit);
            if (dwExit==STILL_ACTIVE)
            {
                m_mulProc->ExitInstance();
                delete m_mulProc;
            }
        }
        
        CDialog::OnClose();

    }

     

     

       


     

    备注

     

     

    相关链接

                               

     

     




  • 相关阅读:
    2.12 使用@DataProvider
    2.11 webdriver中使用 FileUtils ()
    Xcode8 添加PCH文件
    The app icon set "AppIcon" has an unassigned child告警
    Launch Image
    iOS App图标和启动画面尺寸
    iPhone屏幕尺寸、分辨率及适配
    Xcode下载失败 使用已购项目页面再试一次
    could not find developer disk image
    NSDate与 NSString 、long long类型的相互转化
  • 原文地址:https://www.cnblogs.com/xe2011/p/3885682.html
Copyright © 2011-2022 走看看