用什么函数启动多线程啊???

解决方案 »

  1.   

    _beginthread 或 AfxBeginThread
      

  2.   

    用google搜索下ApexComm,里面有源码,用于串口通信的,开辟有读写两个线程,自己去分析下吧
      

  3.   

    AfxBeginThread()
    pfnThreadProc 
    Points to the controlling function for the worker thread. Cannot be NULL. This function must be declared as follows: 
    UINT MyControllingFunction( LPVOID pParam );pThreadClass 
    The RUNTIME_CLASS of an object derived from CWinThread. 
    pParam 
    Parameter to be passed to the controlling function as shown in the parameter to the function declaration in pfnThreadProc. 
    nPriority 
    The desired priority of the thread. If 0, the same priority as the creating thread will be used. For a full list and description of the available priorities, see SetThreadPriority. 
    nStackSize 
    Specifies the size in bytes of the stack for the new thread. If 0, the stack size defaults to the same size stack as the creating thread. 
    dwCreateFlags 
    Specifies an additional flag that controls the creation of the thread. This flag can contain one of two values: 
    CREATE_SUSPENDED   Start the thread with a suspend count of one. Use CREATE_SUSPENDED if you want to initialize any member data of the CWinThread object, such as m_bAutoDelete or any members of your derived class, before the thread starts running. Once your initialization is complete, use the CWinThread::ResumeThread to start the thread running. The thread will not execute until CWinThread::ResumeThread is called. 
    0   Start the thread immediately after creation. 
    lpSecurityAttrs 
    Points to a SECURITY_ATTRIBUTES structure that specifies the security attributes for the thread. If NULL, the same security attributes as the creating thread will be used. For more information on this structure, see the Platform SDK. 
    Return Value
      

  4.   

    设置一个公共信号量,比如ThreadOkEvent。
    某个信号来了,在某个线程里面处理后,ReSet这个信号量,
    然后等别的信号量。。去搞别的线程。
    不知道您是否满意。。呵呵~~。
    都是帅哥。好歹给点分~~~~~~:)