vc6.0+ATL COM Wizard+service(exe),多线程,在mfc dialog中写了服务器端,如何移植到service(exe)中

vc6.0+ATL COM Wizard+service(exe),多线程,在mfc dialog中写了服务器端,怎么移植到service(exe)中
本帖最后由 yongleshangpu 于 2012-09-11 19:15:20 编辑 servicedlg.cpp 中的,initdialog中函数,和uint thread(),这两个函数应该放在atl com appwizard service(exe)的cservicemodule的哪些函数中,可以实现监听端口的功能???
希望知道答案的大侠,帮我看看,最好有语句,应该不长,先谢谢啦!
------解决方案--------------------
引用:
servicedlg.cpp 中的,initdialog中函数,和uint thread(),这两个函数应该放在atl com appwizard service(exe)的cservicemodule的哪些函数中,可以实现监听端口的功能???
希望知道答案的大侠,帮我看看,最好有语句,应该不长,先谢谢啦!
没人理我,自己顶下,别沉了。大家帮帮忙
------解决方案--------------------
引用:
servicedlg.cpp 中的,initdialog中函数,和uint thread(),这两个函数应该放在atl com appwizard service(exe)的cservicemodule的哪些函数中,可以实现监听端口的功能???
希望知道答案的大侠,帮我看看,最好有语句,应该不长,先谢谢啦!
快点啊,大神,现身吧,help ,sos.....
------解决方案--------------------
引用:
servicedlg.cpp 中的,initdialog中函数,和uint thread(),这两个函数应该放在atl com appwizard service(exe)的cservicemodule的哪些函数中,可以实现监听端口的功能???
希望知道答案的大侠,帮我看看,最好有语句,应该不长,先谢谢啦!
inline void CServiceModule::Init(_ATL_OBJMAP_ENTRY* p, HINSTANCE h, UINT nServiceNameID, const GUID* plibid)
{
    CComModule::Init(p, h, plibid);

    m_bService = TRUE;
    
    LoadString(h, nServiceNameID, m_szServiceName, sizeof(m_szServiceName) / sizeof(TCHAR));

    // set up the initial service status 
    m_hServiceStatus = NULL;
    m_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
    m_status.dwCurrentState = SERVICE_STOPPED;
    m_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
    m_status.dwWin32ExitCode = 0;
    m_status.dwServiceSpecificExitCode = 0;
    m_status.dwCheckPoint = 0;
    m_status.dwWaitHint = 0;
 
 
    count=0;
for (int i=0;i<50;i++)
{
msgsock[i]=NULL;
}
//设定地址
serv.sin_addr.s_addr=htonl(INADDR_ANY);
serv.sin_family=AF_INET;
serv.sin_port=htons(56201);//htons(5000);
addlen=sizeof(serv);
//创建socket
sock=socket(AF_INET,SOCK_STREAM,0);
//绑定 
   if (bind(sock,(sockaddr*)&serv,addlen))
   {
   AfxMessageBox("绑定错误");
   }
   else
   {
   //开始侦听
listen(sock,5);
//调用线程,异步线程启动
AfxBeginThread(&thread,0);
//连接服务器
   }
 
 
}
程序源码如上,出现绑定错误???该怎样修改