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();

    }

     

     

       


     

    备注

     

     

    相关链接

                               

     

     




  • 相关阅读:
    USACO第三道题
    uva350 PseudoRandom Numbers
    uva10879 Code Refactoring
    Scrum 冲刺第一篇 晨曦
    WC.exe 晨曦
    [LeetCode 126] 单词梯II(Word Ladder II)
    [LeetCode 129] 根节点到叶子节点数字求和(Sum Root to Leaf Numbers)
    [LeetCode 125] 验证回文(Valid Palindrome)
    [LeetCode 123] 买入与卖出股票的最佳时机III(Best Time to Buy and Sell Stock III)
    [LeetCode 124] 二叉树最大路径和(Binary Tree Maximum Path Sum)
  • 原文地址:https://www.cnblogs.com/xe2011/p/3885682.html
Copyright © 2011-2022 走看看