多线程

#include <Windows.h>
#include <stdlib.h>

DWORD WINAPI mymsg(LPVOID lp)
{
    MessageBoxA(0, "hello", "China", 0);
    return 0;
}

void main()
{
    HANDLE hthread;
    DWORD threadid;//保存线程编号

    for (int i = 0; i < 5; i++)
    {
        hthread = CreateThread(
            NULL,//安全属性
            NULL,//堆栈大小
            mymsg,//线程的入口点
            NULL,//函数的参数
            0,//立即执行
            &threadid);//保存线程的id
        
        WaitForSingleObject(hthread, INFINITE);//一个一个执行
    }

    system("pause");
}
原文地址:https://www.cnblogs.com/xiaochi/p/5098881.html