Click here to Skip to main content
15,914,221 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to detect whether a COM port is available or not ? Pin
brucewayn8-Nov-08 21:45
brucewayn8-Nov-08 21:45 
AnswerRe: How to detect whether a COM port is available or not ? Pin
Rolf Kristensen9-Nov-08 1:29
Rolf Kristensen9-Nov-08 1:29 
QuestionHow can I create a working thread in a MFC regular dll Pin
W.Kim 19878-Nov-08 20:51
W.Kim 19878-Nov-08 20:51 
AnswerRe: How can I create a working thread in a MFC regular dll Pin
Mark Salsbery9-Nov-08 6:30
Mark Salsbery9-Nov-08 6:30 
GeneralRe: How can I create a working thread in a MFC regular dll Pin
W.Kim 19879-Nov-08 14:07
W.Kim 19879-Nov-08 14:07 
GeneralRe: How can I create a working thread in a MFC regular dll Pin
Mark Salsbery9-Nov-08 14:10
Mark Salsbery9-Nov-08 14:10 
GeneralRe: How can I create a working thread in a MFC regular dll [modified] Pin
W.Kim 19879-Nov-08 18:04
W.Kim 19879-Nov-08 18:04 
GeneralRe: How can I create a working thread in a MFC regular dll Pin
Iain Clarke, Warrior Programmer9-Nov-08 22:25
Iain Clarke, Warrior Programmer9-Nov-08 22:25 
The fact that you're using LoadLibrary to load the dll at run time makes a HUGE difference to your question.

In this case, I wouldn't go any near MFC for the DLL at all, just plain vanilla Win32.

I can see one gaping problem though - after you've called resume thread, you return from dllext(), and the promptly call FreeLibrary (). That will (as the name says...) free the library. As you only loaded it once, that will also unload it from your memory. Then windows does a context switch (or could have done at any time - or even simultaneously) to your thread. Which tries to run code that doesn't exist anymore...

Imagine Wile E Coyote running off a cliff, running into mid air for a few seconds, looking down... that's what you've done to your code.

Iain.
GeneralRe: How can I create a working thread in a MFC regular dll Pin
W.Kim 198710-Nov-08 3:06
W.Kim 198710-Nov-08 3:06 
GeneralRe: How can I create a working thread in a MFC regular dll Pin
Mark Salsbery10-Nov-08 4:53
Mark Salsbery10-Nov-08 4:53 
GeneralRe: How can I create a working thread in a MFC regular dll Pin
Mark Salsbery10-Nov-08 5:00
Mark Salsbery10-Nov-08 5:00 
QuestionPointer symbol position and constant member functions Pin
Christian Flutcher8-Nov-08 16:55
Christian Flutcher8-Nov-08 16:55 
AnswerRe: Pointer symbol position and constant member functions Pin
Saurabh.Garg8-Nov-08 18:55
Saurabh.Garg8-Nov-08 18:55 
GeneralRe: Pointer symbol position and constant member functions Pin
Christian Flutcher9-Nov-08 5:35
Christian Flutcher9-Nov-08 5:35 
AnswerRe: Pointer symbol position and constant member functions Pin
toxcct9-Nov-08 3:05
toxcct9-Nov-08 3:05 
GeneralRe: Pointer symbol position and constant member functions Pin
Christian Flutcher9-Nov-08 5:30
Christian Flutcher9-Nov-08 5:30 
AnswerRe: Pointer symbol position and constant member functions Pin
Iain Clarke, Warrior Programmer9-Nov-08 4:04
Iain Clarke, Warrior Programmer9-Nov-08 4:04 
GeneralRe: Pointer symbol position and constant member functions Pin
Christian Flutcher9-Nov-08 5:32
Christian Flutcher9-Nov-08 5:32 
QuestionHow to format like this 123,456,789.00? Pin
followait8-Nov-08 16:05
followait8-Nov-08 16:05 
AnswerRe: How to format like this 123,456,789.00? Pin
Saurabh.Garg8-Nov-08 18:57
Saurabh.Garg8-Nov-08 18:57 
GeneralRe: How to format like this 123,456,789.00? Pin
followait8-Nov-08 19:41
followait8-Nov-08 19:41 
AnswerRe: How to format like this 123,456,789.00? Pin
Randor 8-Nov-08 19:00
professional Randor 8-Nov-08 19:00 
AnswerRe: How to format like this 123,456,789.00? Pin
Hamid_RT8-Nov-08 20:22
Hamid_RT8-Nov-08 20:22 
QuestionWhy dosen't ShellExecute run some of commands? Pin
Joseph Marzbani8-Nov-08 9:26
Joseph Marzbani8-Nov-08 9:26 
AnswerRe: Why dosen't ShellExecute run some of commands? Pin
Mark Salsbery8-Nov-08 13:43
Mark Salsbery8-Nov-08 13:43 

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.