Click here to Skip to main content
15,797,167 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: OnFileOpen crashing Pin
SoMad5-Apr-13 11:58
professionalSoMad5-Apr-13 11:58 
AnswerRe: OnFileOpen crashing [solved] Pin
_Flaviu5-Apr-13 3:18
_Flaviu5-Apr-13 3:18 
GeneralRe: OnFileOpen crashing [solved] Pin
David Crow5-Apr-13 4:14
David Crow5-Apr-13 4:14 
GeneralRe: OnFileOpen crashing [solved] Pin
Richard MacCutchan5-Apr-13 4:35
mveRichard MacCutchan5-Apr-13 4:35 
GeneralRe: OnFileOpen crashing [solved] Pin
SoMad5-Apr-13 8:39
professionalSoMad5-Apr-13 8:39 
QuestionWindows Service Controler & CAsyncSocket Pin
Member 33971274-Apr-13 21:43
Member 33971274-Apr-13 21:43 
AnswerRe: Windows Service Controler & CAsyncSocket Pin
Jochen Arndt4-Apr-13 23:55
professionalJochen Arndt4-Apr-13 23:55 
GeneralRe: Windows Service Controler & CAsyncSocket Pin
Member 33971275-Apr-13 2:46
Member 33971275-Apr-13 2:46 
thanks for answer my question
i change a little my code like this...
C++
BOOL CMyThread::InitInstance()
{

	while (!AfxSocketInit());
	MySocket sock;
	while (sock.Create(3005)==SOCKET_ERROR);
	while (sock.Listen()==SOCKET_ERROR);
	HANDLE file;
	file=CreateFile(_T("C:\\initinstance.txt"),GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
	CloseHandle(file);
	 Sleep(30000);
	return TRUE;
}

socket listening for 30 sec with 6 thread
and after 30 sec thread is 5 and socket is close.
so...
and i understand my thread is closed after that..
here is my code for create thread...
C++
CMyThread* pThread =
    (CMyThread*)AfxBeginThread(
    RUNTIME_CLASS(CMyThread),
    THREAD_PRIORITY_NORMAL,
    0,
    CREATE_SUSPENDED);
while(pThread==NULL)
{
    Sleep(1);
    pThread =
        (CMyThread*)AfxBeginThread(
        RUNTIME_CLASS(CMyThread),
        THREAD_PRIORITY_NORMAL,
        0,
        CREATE_SUSPENDED);
}
pThread->ResumeThread();

WaitForSingleObject(pThread->m_hThread,INFINITE);


what do you think? do i have mistake here?
and i'm no sure about calling "WaitForSingleObject(pThread->m_hThread,INFINITE);"
GeneralRe: Windows Service Controler & CAsyncSocket Pin
Jochen Arndt5-Apr-13 3:18
professionalJochen Arndt5-Apr-13 3:18 
AnswerRe: Windows Service Controler & CAsyncSocket Pin
Member 33971275-Apr-13 4:27
Member 33971275-Apr-13 4:27 
QuestionTimer not working properly. Pin
Le@rner4-Apr-13 21:25
Le@rner4-Apr-13 21:25 
AnswerRe: Timer not working properly. Pin
Captain Price4-Apr-13 22:24
professionalCaptain Price4-Apr-13 22:24 
QuestionRe: Timer not working properly. Pin
CPallini5-Apr-13 0:03
mveCPallini5-Apr-13 0:03 
AnswerRe: Timer not working properly. Pin
David Crow5-Apr-13 4:17
David Crow5-Apr-13 4:17 
GeneralRe: Timer not working properly. Pin
Le@rner5-Apr-13 20:34
Le@rner5-Apr-13 20:34 
QuestionRe: Timer not working properly. Pin
Kenneth Haugland6-Apr-13 4:06
professionalKenneth Haugland6-Apr-13 4:06 
AnswerRe: Timer not working properly. Pin
Le@rner10-Apr-13 23:07
Le@rner10-Apr-13 23:07 
QuestionRetaining selection on a ListCtrl Item Pin
Donguy19764-Apr-13 15:21
Donguy19764-Apr-13 15:21 
AnswerRe: Retaining selection on a ListCtrl Item Pin
SoMad4-Apr-13 16:07
professionalSoMad4-Apr-13 16:07 
GeneralRe: Retaining selection on a ListCtrl Item Pin
Donguy19765-Apr-13 10:27
Donguy19765-Apr-13 10:27 
GeneralRe: Retaining selection on a ListCtrl Item Pin
SoMad5-Apr-13 11:47
professionalSoMad5-Apr-13 11:47 
GeneralRe: Retaining selection on a ListCtrl Item Pin
Donguy19765-Apr-13 12:32
Donguy19765-Apr-13 12:32 
GeneralRe: Retaining selection on a ListCtrl Item Pin
SoMad5-Apr-13 22:39
professionalSoMad5-Apr-13 22:39 
QuestionHow to resize a dialog? Pin
Donguy19764-Apr-13 15:18
Donguy19764-Apr-13 15:18 
AnswerRe: How to resize a dialog? Pin
Garth J Lancaster4-Apr-13 16:24
professionalGarth J Lancaster4-Apr-13 16:24 

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.