Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionAccessing synch object in DirectDraw Pin
Code-o-mat17-Oct-09 12:16
Code-o-mat17-Oct-09 12:16 
Questionhow to draw in a dialog's client area, but from an event ocurred in another dialog? Pin
timbk17-Oct-09 10:53
timbk17-Oct-09 10:53 
AnswerRe: how to draw in a dialog's client area, but from an event ocurred in another dialog? Pin
Hans Dietrich17-Oct-09 18:45
mentorHans Dietrich17-Oct-09 18:45 
GeneralRe: how to draw in a dialog's client area, but from an event ocurred in another dialog? Pin
timbk18-Oct-09 5:46
timbk18-Oct-09 5:46 
Questionalphanumaric and numeric checking Pin
Omegaclass17-Oct-09 10:22
Omegaclass17-Oct-09 10:22 
AnswerRe: alphanumaric and numeric checking Pin
«_Superman_»17-Oct-09 11:38
professional«_Superman_»17-Oct-09 11:38 
GeneralRe: alphanumaric and numeric checking Pin
Omegaclass17-Oct-09 13:23
Omegaclass17-Oct-09 13:23 
Questiondialog based MFC multithreaded server Pin
Manmohan2917-Oct-09 7:17
Manmohan2917-Oct-09 7:17 
I am writing a multithreaded TCP server(MFC).
The steps I am following are:-
1.)Create a listen socket.
2.)listen on specific port.
3.)spin individual thread for every client that connects.

My application is a dialog based MFC App.But it crashes when a client connects to it. Frown | :(
While spinning the THREAD what parameter should I pass to the thread's main function(CDialog Object or listening socket).Confused | :confused:
what type of thread should I Create WORKER or UI.
My code is like this:-

// sockDlg.cpp : implementation file

BOOL CsockDlg::OnInitDialog()
{
	.
        .
        .
	// TODO: Add extra initialization here
	int m_iPort = 4000;

	m_sConnectSocket.SetParent(this);      // Object of CMySocket derived from CAsyncSocket
	m_sListenSocket.SetParent(this);       // // Object of CMySocket derived from CAsyncSocket

	m_sListenSocket.Create(m_iPort);
	m_sListenSocket.Listen();

	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CsockDlg::OnAccept(void)
{
	//m_sListenSocket.Accept(m_sConnectSocket);
	AfxBeginThread(ThreadServer, this);
}

UINT CsockDlg::ThreadServer(LPVOID pParam)
{
	CsockDlg* C = (CsockDlg*)pParam;
	CAsyncSocket client;
	C->m_sListenSocket.Accept(client);
	//::Sleep(60000);
	return 0;
}


I have seen many examples for console servers but how to implement it on a Dialog Based Application?????

Future Lies in Present.
Manmohan Bishnoi

AnswerRe: dialog based MFC multithreaded server Pin
Moak17-Oct-09 8:21
Moak17-Oct-09 8:21 
GeneralRe: dialog based MFC multithreaded server Pin
Manmohan2917-Oct-09 9:12
Manmohan2917-Oct-09 9:12 
GeneralRe: dialog based MFC multithreaded server Pin
Manmohan2917-Oct-09 9:22
Manmohan2917-Oct-09 9:22 
GeneralRe: dialog based MFC multithreaded server Pin
Rajesh R Subramanian17-Oct-09 10:28
professionalRajesh R Subramanian17-Oct-09 10:28 
GeneralRe: dialog based MFC multithreaded server Pin
Moak17-Oct-09 11:12
Moak17-Oct-09 11:12 
NewsRe: dialog based MFC multithreaded server Pin
Manmohan2918-Oct-09 0:48
Manmohan2918-Oct-09 0:48 
GeneralRe: dialog based MFC multithreaded server Pin
Rajesh R Subramanian18-Oct-09 2:38
professionalRajesh R Subramanian18-Oct-09 2:38 
GeneralRe: dialog based MFC multithreaded server Pin
Manmohan2918-Oct-09 4:03
Manmohan2918-Oct-09 4:03 
GeneralRe: dialog based MFC multithreaded server Pin
Moak18-Oct-09 8:04
Moak18-Oct-09 8:04 
QuestionIs there any existing function to change language ID to language String? Pin
includeh1017-Oct-09 3:11
includeh1017-Oct-09 3:11 
AnswerRe: Is there any existing function to change language ID to language String? Pin
Michael Schubert17-Oct-09 5:22
Michael Schubert17-Oct-09 5:22 
QuestionC++ advanced literature pls? Pin
lawsmlt17-Oct-09 3:02
lawsmlt17-Oct-09 3:02 
Questionhow to undef a typedef? Pin
includeh1016-Oct-09 23:35
includeh1016-Oct-09 23:35 
AnswerRe: how to undef a typedef? Pin
Cedric Moonen16-Oct-09 23:50
Cedric Moonen16-Oct-09 23:50 
GeneralRe: how to undef a typedef? Pin
includeh1017-Oct-09 0:21
includeh1017-Oct-09 0:21 
GeneralRe: how to undef a typedef? Pin
Maximilien17-Oct-09 1:18
Maximilien17-Oct-09 1:18 
GeneralRe: how to undef a typedef? Pin
includeh1017-Oct-09 2:04
includeh1017-Oct-09 2:04 

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.