Click here to Skip to main content
15,917,642 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Length of SQL-query Pin
toxcct24-Aug-06 22:33
toxcct24-Aug-06 22:33 
GeneralRe: Length of SQL-query Pin
ensger25-Aug-06 0:29
ensger25-Aug-06 0:29 
QuestionBlogging with VC++ Pin
_AnsHUMAN_ 24-Aug-06 21:53
_AnsHUMAN_ 24-Aug-06 21:53 
AnswerRe: Blogging with VC++ Pin
Michael P Butler24-Aug-06 22:05
Michael P Butler24-Aug-06 22:05 
GeneralRe: Blogging with VC++ Pin
_AnsHUMAN_ 27-Aug-06 22:37
_AnsHUMAN_ 27-Aug-06 22:37 
AnswerRe: Blogging with VC++ Pin
Zac Howland25-Aug-06 6:44
Zac Howland25-Aug-06 6:44 
GeneralRe: Blogging with VC++ Pin
_AnsHUMAN_ 27-Aug-06 22:36
_AnsHUMAN_ 27-Aug-06 22:36 
QuestionHow to create a new thread to init socket in DLL? Pin
teawater24-Aug-06 21:47
teawater24-Aug-06 21:47 
I hava writen a DLL,and injected DLL into a process.But when I inject DLL into target process every time,it will terminate the target process.If I don't create a new thread in DLL,it work well.How can I write correct code to implement?
ps: testdll.cpp
#include "stdafx.h"

#include <afxdllx.h>

#include "process.h"



#ifdef _DEBUG

#define new DEBUG_NEW

#endif



static AFX_EXTENSION_MODULE TestDLL = { NULL, NULL };



unsigned __stdcall ThreadFunc(LPVOID pParam){

CSocket sockListen,m_sockSend;

sockListen.Create(6802,SOCK_STREAM,"127.0.0.1");

sockListen.Bind(6802,"127.0.0.1");

sockListen.Listen(5);

sockListen.Accept(m_sockSend);

Sleep(50000);

sockListen.Close();

MessageBox(NULL,"ThreadFunc","Oops!!",MB_OK);

return 0;

}



extern "C" int APIENTRY

DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)

{

UNREFERENCED_PARAMETER(lpReserved);



if (dwReason == DLL_PROCESS_ATTACH)

{

TRACE0("Test.DLL !\n");

if (!AfxInitExtensionModule(TestDLL, hInstance))

return 0;

new CDynLinkLibrary(TestDLL);

_beginthreadex(NULL,0,ThreadFunc,NULL,0,NULL);



}

else if (dwReason == DLL_PROCESS_DETACH)

{

TRACE0("Test.DLL !\n");

AfxTermExtensionModule(TestDLL);

}

return 1;

}
AnswerRe: How to create a new thread to init socket in DLL? Pin
teawater25-Aug-06 14:38
teawater25-Aug-06 14:38 
QuestionReceiveFrom(); [modified] Pin
ramanand_bulusu24-Aug-06 21:43
ramanand_bulusu24-Aug-06 21:43 
AnswerRe: ReceiveFrom(); Pin
uday kiran janaswamy24-Aug-06 23:42
uday kiran janaswamy24-Aug-06 23:42 
AnswerRe: ReceiveFrom(); Pin
uday kiran janaswamy24-Aug-06 23:43
uday kiran janaswamy24-Aug-06 23:43 
AnswerRe: ReceiveFrom(); Pin
Hamid_RT25-Aug-06 0:56
Hamid_RT25-Aug-06 0:56 
QuestionRe: ReceiveFrom(); Pin
David Crow25-Aug-06 2:44
David Crow25-Aug-06 2:44 
Questionproblem in loading XML Pin
raycadarena24-Aug-06 21:13
raycadarena24-Aug-06 21:13 
QuestionNon Rectangular Edit Box Pin
kiranin24-Aug-06 20:57
kiranin24-Aug-06 20:57 
AnswerRe: Non Rectangular Edit Box Pin
toxcct24-Aug-06 21:53
toxcct24-Aug-06 21:53 
GeneralRe: Non Rectangular Edit Box Pin
kiranin24-Aug-06 22:07
kiranin24-Aug-06 22:07 
GeneralRe: Non Rectangular Edit Box Pin
Hamid_RT24-Aug-06 22:49
Hamid_RT24-Aug-06 22:49 
AnswerRe: Non Rectangular Edit Box Pin
Christian Graus24-Aug-06 22:22
protectorChristian Graus24-Aug-06 22:22 
AnswerRe: Non Rectangular Edit Box Pin
Waldermort24-Aug-06 22:42
Waldermort24-Aug-06 22:42 
QuestionEdit Control multiline - number of lines Pin
Joy Anne24-Aug-06 20:51
Joy Anne24-Aug-06 20:51 
AnswerRe: Edit Control multiline - number of lines Pin
_AnsHUMAN_ 24-Aug-06 22:03
_AnsHUMAN_ 24-Aug-06 22:03 
AnswerRe: Edit Control multiline - number of lines Pin
toxcct24-Aug-06 22:39
toxcct24-Aug-06 22:39 
GeneralRe: Edit Control multiline - number of lines Pin
David Crow25-Aug-06 2:49
David Crow25-Aug-06 2:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.