Click here to Skip to main content
15,892,768 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: C code in VC Pin
CPallini20-Feb-10 11:15
mveCPallini20-Feb-10 11:15 
AnswerRe: C code in VC Pin
Rajesh R Subramanian21-Feb-10 1:02
professionalRajesh R Subramanian21-Feb-10 1:02 
Questionmfc receive sms [modified] Pin
saneevil20-Feb-10 3:16
saneevil20-Feb-10 3:16 
AnswerRe: mfc receive sms Pin
CPallini20-Feb-10 4:16
mveCPallini20-Feb-10 4:16 
QuestionMore help sought for my Monitoring and Controlling Worker Thread article... Pin
Ben Aldhouse20-Feb-10 2:11
Ben Aldhouse20-Feb-10 2:11 
AnswerRe: More help sought for my Monitoring and Controlling Worker Thread article... Pin
Stephen Hewitt20-Feb-10 3:24
Stephen Hewitt20-Feb-10 3:24 
GeneralRe: More help sought for my Monitoring and Controlling Worker Thread article... Pin
Ben Aldhouse20-Feb-10 21:35
Ben Aldhouse20-Feb-10 21:35 
AnswerRe: More help sought for my Monitoring and Controlling Worker Thread article... Pin
Randor 20-Feb-10 11:53
professional Randor 20-Feb-10 11:53 
I took a brief look at your article. I have some humble comments/observations.

1.) Yes you should get rid of the call to Sleep. I have never found any use for this API call and in my opinion it is probably the most abused function on planet Earth. I recommend the following:

a) Add: HANDLE hEvent; to your CFormView.
b) Call hEvent = CreateEvent(NULL,FALSE,FALSE,"Your-GUID"); in your constructor.
c) Call SetEvent(hEvent); in your OnCURFILEEVENT message handler.
d) Replace the Sleep(1) with: WaitForSingleObject(hEvent,1000); and then reset the event with ResetEvent(hEvent); immediately afterwards.

2.) Regarding your access violation... I instantly recognized the problem. You are incorrectly accessing a CString object that lives inside your CFormView from the worker thread. CString is NOT thread-safe. You need to replace the pMyView->m_strCurFile assignment with a message function such as SendMessageTimeout[^] and this will fix the Access Violation in your article.

Best Wishes,
-David Delaune
GeneralRe: More help sought for my Monitoring and Controlling Worker Thread article... Pin
Ben Aldhouse20-Feb-10 21:43
Ben Aldhouse20-Feb-10 21:43 
GeneralRe: More help sought for my Monitoring and Controlling Worker Thread article... Pin
Ben Aldhouse26-Feb-10 11:49
Ben Aldhouse26-Feb-10 11:49 
GeneralRe: More help sought for my Monitoring and Controlling Worker Thread article... Pin
Ben Aldhouse13-Apr-10 10:38
Ben Aldhouse13-Apr-10 10:38 
Questionhow do i send a long sms exceeding 160 characters using AT command? Pin
Le@rner20-Feb-10 1:03
Le@rner20-Feb-10 1:03 
AnswerRe: how do i send a long sms exceeding 160 characters using AT command? PinPopular
Richard MacCutchan20-Feb-10 4:05
mveRichard MacCutchan20-Feb-10 4:05 
QuestionHow Do display a Name in place of SMS sender phone no using AT Commands? Pin
Le@rner19-Feb-10 23:43
Le@rner19-Feb-10 23:43 
AnswerRe: How Do display a Name in place of SMS sender phone no using AT Commands? Pin
Garth J Lancaster20-Feb-10 0:10
professionalGarth J Lancaster20-Feb-10 0:10 
AnswerRe: How Do display a Name in place of SMS sender phone no using AT Commands? Pin
Richard MacCutchan20-Feb-10 0:37
mveRichard MacCutchan20-Feb-10 0:37 
QuestionRe: How Do display a Name in place of SMS sender phone no using AT Commands? Pin
Maximilien20-Feb-10 1:48
Maximilien20-Feb-10 1:48 
AnswerRe: How Do display a Name in place of SMS sender phone no using AT Commands? Pin
Le@rner20-Feb-10 1:53
Le@rner20-Feb-10 1:53 
GeneralRe: How Do display a Name in place of SMS sender phone no using AT Commands? Pin
Richard MacCutchan20-Feb-10 4:02
mveRichard MacCutchan20-Feb-10 4:02 
GeneralRe: How Do display a Name in place of SMS sender phone no using AT Commands? Pin
Maximilien20-Feb-10 4:26
Maximilien20-Feb-10 4:26 
GeneralRe: How Do display a Name in place of SMS sender phone no using AT Commands? Pin
Le@rner21-Feb-10 18:20
Le@rner21-Feb-10 18:20 
GeneralRe: How Do display a Name in place of SMS sender phone no using AT Commands? Pin
m_k_b_h14-Jul-11 0:02
m_k_b_h14-Jul-11 0:02 
QuestionSecondary Desktop Pin
trioum19-Feb-10 21:11
trioum19-Feb-10 21:11 
AnswerRe: Secondary Desktop Pin
Richard MacCutchan20-Feb-10 0:38
mveRichard MacCutchan20-Feb-10 0:38 
GeneralRe: Secondary Desktop Pin
Maximilien20-Feb-10 1:53
Maximilien20-Feb-10 1:53 

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.