伪代码:
 CA()
 {
   CreateThread( 
NULL,              // default security attributes
0,                 // use default stack size  
DoXlanMsg,          // thread function 
this,             // argument to thread function 
0,                 // use default creation flags 
&dwThreadId[i]);   // returns the thread identifier 
  }  *** DoXlanMsg(*** lp)
   {
      CA* app = (CA*)lp;
      if (NULL == app)
{
return 0;
}
   }为什么release版本会进入 return 0阿?在debug版本中不进.
构造函数中应该就已经开始实例化对象了阿。  

解决方案 »

  1.   

    作为一个windows程序员,很辛苦,特别是英语不太好的,MSDN的帮助虽然非常全面,但单词的专业化翻译我们还是翻译不准,结果导致很多技术的误解和误用.本人经过很长时间才搜集了五本书,自我感到非常好.这是五本书的压缩包,分别是:程序员参考大全(一)--窗口管理和图形设备接口;程序员参考大全(二)--系统服务、多媒体、系统扩展;程序员参考大全(三)--函数API[A-G];程序员参考大全(四)--函数API[H-Z];程序员参考大全(五)--消息、结构和宏。如果你看完这五本书,你肯定是windows编程大师。下载地址是:http://download.csdn.net/detail/wangxiangdong_sl/3584562,希望给大家帮助.
      

  2.   

    我觉得release也应该不会参数无效吧。
    你可以试试_beginthreadex,如果是MFC,试试AfxBeginThread
      

  3.   

    我试了下,Release不会进lz说的code啊#include "iostream"
    #include <windows.h>
    using namespace std;
    DWORD __stdcall DoXlanMsg(void* pv)
    {
    if (NULL == pv)
    {
    cout<<"pv == NULL"<<endl;
    return 0;
    }
    int i=0;
    while (1)
    {
    Sleep(1000);
    cout<<"hello "<<i++<<endl;
    }
    return 0;
    }class CA
    {
    public:
    CA()
    {
    /*m_hThread=*/CreateThread( 
    NULL, // default security attributes
    0, // use default stack size  
    DoXlanMsg, // thread function 
    this, // argument to thread function 
    0, // use default creation flags 
    NULL); // returns the thread identifier  
    }
    ~CA()
    {
    if (m_hThread)
    {
    //TerminateThread(m_hThread,0);
    }
    } HANDLE GetThrd(){return m_hThread;}
    private:
    HANDLE m_hThread;};int main()
    {
    cout<<"hello"<<endl;
    CA a;
    //WaitForSingleObject(a.GetThrd(),INFINITE);
    Sleep(50000);
    return 0;
    }
      

  4.   

    lz可以在进入CreateThread函数之前打印this的值看看
      

  5.   

    只要进入构造函数,就已经为对象分配内存了,此时this指针怎么着也不会为NULL啊
      

  6.   

    那感情好,构造函数返回或者不返回是一样的,pop和push都是弄着玩的,不起作用
      

  7.   

    我也是把调代码时发现的一些不太理解的东西,发上来和大家讨论一下.
    确实是debug正常,但release,返回了。