Click here to Skip to main content
15,916,702 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Build Automated DLL to be interfaced to VB6.0 Pin
thealca18-Jul-05 14:01
thealca18-Jul-05 14:01 
General"Temporary Internet Files" location using WinInet Pin
Chintoo72313-Jul-05 19:10
Chintoo72313-Jul-05 19:10 
GeneralRe: "Temporary Internet Files" location using WinInet Pin
Chintoo72313-Jul-05 19:31
Chintoo72313-Jul-05 19:31 
QuestionTrying to hide task bar but SPI_SETWORKAREA not working? Pin
retro_coder13-Jul-05 18:51
retro_coder13-Jul-05 18:51 
AnswerRe: Trying to hide task bar but SPI_SETWORKAREA not working? (SOLVED) Pin
retro_coder13-Jul-05 19:08
retro_coder13-Jul-05 19:08 
GeneralAt exit Pin
Fernando A. Gomez F.13-Jul-05 17:19
Fernando A. Gomez F.13-Jul-05 17:19 
GeneralRe: At exit Pin
Christian Graus13-Jul-05 18:38
protectorChristian Graus13-Jul-05 18:38 
GeneralRe: At exit Pin
Toby Opferman13-Jul-05 19:37
Toby Opferman13-Jul-05 19:37 
GeneralRe: At exit Pin
Alexander M.,14-Jul-05 2:05
Alexander M.,14-Jul-05 2:05 
GeneralDocking Resizable Dialog box Pin
mlsa13-Jul-05 15:55
mlsa13-Jul-05 15:55 
GeneralRe: Docking Resizable Dialog box Pin
Stlan13-Jul-05 21:39
Stlan13-Jul-05 21:39 
GeneralRe: Docking Resizable Dialog box Pin
mlsa14-Jul-05 9:25
mlsa14-Jul-05 9:25 
GeneralRe: Docking Resizable Dialog box Pin
Stlan14-Jul-05 19:31
Stlan14-Jul-05 19:31 
GeneralDetect Ctrl key pressed Pin
Ravi Bhavnani13-Jul-05 14:00
professionalRavi Bhavnani13-Jul-05 14:00 
GeneralRe: Detect Ctrl key pressed Pin
Christian Graus13-Jul-05 14:11
protectorChristian Graus13-Jul-05 14:11 
GeneralRe: Detect Ctrl key pressed Pin
Blake Miller14-Jul-05 4:39
Blake Miller14-Jul-05 4:39 
GeneralRe: Detect Ctrl key pressed Pin
Jack Puppy13-Jul-05 14:33
Jack Puppy13-Jul-05 14:33 
GeneralRe: Detect Ctrl key pressed Pin
Aamir Butt13-Jul-05 20:15
Aamir Butt13-Jul-05 20:15 
GeneralThanks, all! Pin
Ravi Bhavnani14-Jul-05 6:20
professionalRavi Bhavnani14-Jul-05 6:20 
GeneralWorker thread question Pin
Tom Wright13-Jul-05 12:26
Tom Wright13-Jul-05 12:26 
GeneralRe: Worker thread question Pin
Blake Miller13-Jul-05 13:00
Blake Miller13-Jul-05 13:00 
GeneralRe: Worker thread question Pin
Tom Wright14-Jul-05 5:24
Tom Wright14-Jul-05 5:24 
GeneralRe: Worker thread question Pin
Blake Miller14-Jul-05 6:18
Blake Miller14-Jul-05 6:18 
1. You need to protect a string at the time the string is accessed.

If you really want to display the messagebox, I would make a local copy, but protect the copy process with the critical section.

UINT CLAQTermDlg::MyIOThread(LPVOID pParam )
{
CLAQTermDlg * myDlg = (CLAQTermDlg *)pParam;

CString csMessage;
EnterCriticalSection(...);
csMessage = myDlg->sText;
LeaveCriticalSection(...);


::MessageBox(NULL, csMessage, "In my Thread", MB_OK );
return 0; //Thread completed successfully
}


2. If you need the data longer, then make a variable as part of your thread class or a local variable in the thread function, and perform a protected copy, similar to above example. You also need to use same critical section in other parts of your code wherever the myDlg->sText is modified or accessed.

3. The array would be unique if it is local to the thread function or else if it is a member variable of a derived thread class, since you would be creating an instance of the thread class for each thread which is run. Just don't declare the member variable as static or it is shared among all instances of a class.
GeneralReading a .prn file Pin
bugDanny13-Jul-05 11:05
bugDanny13-Jul-05 11:05 
GeneralRe: Reading a .prn file Pin
normanS13-Jul-05 20:46
normanS13-Jul-05 20:46 

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.