Click here to Skip to main content
15,889,992 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: NetServerDiskEnum Example Pin
Richard MacCutchan14-Oct-09 2:08
mveRichard MacCutchan14-Oct-09 2:08 
GeneralRe: NetServerDiskEnum Example Pin
Abinash Mohanty14-Oct-09 18:07
Abinash Mohanty14-Oct-09 18:07 
GeneralRe: NetServerDiskEnum Example Pin
Richard MacCutchan14-Oct-09 21:59
mveRichard MacCutchan14-Oct-09 21:59 
GeneralRe: NetServerDiskEnum Example Pin
Abinash Mohanty14-Oct-09 23:09
Abinash Mohanty14-Oct-09 23:09 
QuestionMultithreaded App Pin
Manmohan2913-Oct-09 23:27
Manmohan2913-Oct-09 23:27 
AnswerRe: Multithreaded App Pin
CPallini13-Oct-09 23:45
mveCPallini13-Oct-09 23:45 
AnswerRe: Multithreaded App Pin
Game-point14-Oct-09 1:16
Game-point14-Oct-09 1:16 
AnswerRe: Multithreaded App Pin
Rajesh R Subramanian14-Oct-09 2:05
professionalRajesh R Subramanian14-Oct-09 2:05 
Manmohan29 wrote:
doesnot compile


And what does the compiler say? Be specific.

To add to it,

Manmohan29 wrote:
UINT ThreadFunc(LPVOID pParam)
{
MessageBox("Thread Started"); //----> BAD idea!
return 0;
}

void CAppDlg::OnButtonClkRunThread()
{
AfxBeginThread(ThreadFunc, this);
}


Because if your main thread becomes busy into something, the newly spawned thread as well would block for displaying the message. This is because you are using a function (MessageBox from MFC) that would make use of the default message pump of your application.

In other words, if you add a Sleep(3000); after AfxBeginThread, the message from your thread would probably be displayed after this sleep period only!

I see you're just starting to learn, but threading has such "gotchas", that you'll learn along the way. Lesson learned today: It isn't a great idea to use something within a worker thread, that may in turn use the default message pump of the application (in a blocking fashion). Smile | :)


“Follow your bliss.” – Joseph Campbell

GeneralRe: Multithreaded App Pin
Manmohan2914-Oct-09 4:14
Manmohan2914-Oct-09 4:14 
AnswerRe: Multithreaded App Pin
Rajesh R Subramanian14-Oct-09 4:16
professionalRajesh R Subramanian14-Oct-09 4:16 
GeneralRe: Multithreaded App Pin
Roger Stoltz14-Oct-09 4:27
Roger Stoltz14-Oct-09 4:27 
GeneralRe: Multithreaded App Pin
Rajesh R Subramanian14-Oct-09 4:30
professionalRajesh R Subramanian14-Oct-09 4:30 
GeneralRe: Multithreaded App Pin
Manmohan2914-Oct-09 5:55
Manmohan2914-Oct-09 5:55 
Questionresolving link error LNK1241 Pin
KASR113-Oct-09 19:40
KASR113-Oct-09 19:40 
AnswerRe: resolving link error LNK1241 Pin
David Crow14-Oct-09 2:40
David Crow14-Oct-09 2:40 
QuestionCursor in edit box Pin
sonualex13-Oct-09 18:53
sonualex13-Oct-09 18:53 
AnswerRe: Cursor in edit box Pin
David Crow14-Oct-09 2:23
David Crow14-Oct-09 2:23 
GeneralRe: Cursor in edit box Pin
sonualex14-Oct-09 3:32
sonualex14-Oct-09 3:32 
GeneralRe: Cursor in edit box Pin
David Crow14-Oct-09 3:39
David Crow14-Oct-09 3:39 
GeneralRe: Cursor in edit box Pin
sonualex14-Oct-09 20:46
sonualex14-Oct-09 20:46 
QuestionRe: Cursor in edit box Pin
David Crow15-Oct-09 3:00
David Crow15-Oct-09 3:00 
AnswerRe: Cursor in edit box Pin
sonualex15-Oct-09 3:32
sonualex15-Oct-09 3:32 
AnswerRe: Cursor in edit box Pin
David Crow15-Oct-09 4:10
David Crow15-Oct-09 4:10 
GeneralRe: Cursor in edit box Pin
sonualex15-Oct-09 22:38
sonualex15-Oct-09 22:38 
GeneralRe: Cursor in edit box Pin
David Crow16-Oct-09 2:34
David Crow16-Oct-09 2:34 

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.