Click here to Skip to main content
15,915,603 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to get Undo/Redo effect as in Notepad like applications Pin
Hashim Saleem21-Nov-03 15:10
Hashim Saleem21-Nov-03 15:10 
AnswerRe: How to get Undo/Redo effect as in Notepad like applications Pin
l a u r e n21-Nov-03 18:45
l a u r e n21-Nov-03 18:45 
Generalremoving a char array from another Pin
thunderflash2121-Nov-03 12:20
thunderflash2121-Nov-03 12:20 
GeneralRe: removing a char array from another Pin
Anonymous21-Nov-03 12:43
Anonymous21-Nov-03 12:43 
GeneralRe: removing a char array from another Pin
thunderflash2121-Nov-03 15:35
thunderflash2121-Nov-03 15:35 
GeneralRe: removing a char array from another Pin
thunderflash2121-Nov-03 15:41
thunderflash2121-Nov-03 15:41 
GeneralRe: removing a char array from another Pin
Rickard Andersson2022-Nov-03 5:38
Rickard Andersson2022-Nov-03 5:38 
GeneralPlease help with Threads Pin
tqdo21-Nov-03 11:59
tqdo21-Nov-03 11:59 
I am creating a dialog-based application using C++, MFC.
This application will need to open a socket and retrieve
data from a socket, assign it to a buffer and need to process
the buffer after that.

The application is working fine but while it is retrieving
the data and processing on it, the GUI seems "hang" and not
responsive!. So I wanted to create a worker thread to taking
care of the retrieving and processing the data, but I am not
familiar much with thread.

So do you have any simple window applications/samples that creates a
worker thread that is taking care of the processing part while
the GUI is still "active", responsive to user's action?

Currently, I have a wrapper class derived from CAsynSocket that
takes care of connecting and getting the data buffer from the
socket. Then when I have a complete data buffer, I notify the
dialog using a callback function.
So in the main dialog, I have:
CMainDialog::OnReceiveCompleteMessage( BYTE * pbData, int len)

And this method will be called everytime there is a new complete
data buffer. I have to process these messages so within this
method, I call "ProcessingMessage()". It works OK so far but
after it is running for while, if I bring up some other applications,
and then click on the icon to bring this dialog back up, it seems
"freeze" for awhile, and takes some time to refresh and display
the whole dialog..Frown | :(

So I want to create worker thread so that everytime the
OnReceiveCompleteMessage() is called, this thread will do the
processing part background and the GUI is still "active". Is it
OK if within the OnReceiveCompleteMessage(), I have the code:
m_hRunThread = ::CreateThread(NULL, 0, RunThreadFunc,
(LPVOID) this, 0, &dwThreadId);
so that each time the function is called, it will create a new
thread to do the processing (with same m_hRunThread handle but
different dwThreadId)? Within the RunThreadFunc(), I call the
ProcessingMessage().
I tried but it didn't work. So please help!
Thanks a lot!!!

TQD
GeneralRe: Please help with Threads Pin
Peter Molnar21-Nov-03 12:16
Peter Molnar21-Nov-03 12:16 
GeneralShifting elements of struct over to next element.. Pin
IrishSonic21-Nov-03 10:49
IrishSonic21-Nov-03 10:49 
GeneralRe: Shifting elements of struct over to next element.. Pin
Michael Dunn21-Nov-03 11:14
sitebuilderMichael Dunn21-Nov-03 11:14 
GeneralInserting a char array into another Pin
thunderflash2121-Nov-03 10:47
thunderflash2121-Nov-03 10:47 
GeneralRe: Inserting a char array into another Pin
m0xx21-Nov-03 11:48
m0xx21-Nov-03 11:48 
GeneralSOCKADDR_IN structure port conversion Pin
Kuniva21-Nov-03 10:06
Kuniva21-Nov-03 10:06 
GeneralRe: SOCKADDR_IN structure port conversion Pin
Mike Dimmick21-Nov-03 13:05
Mike Dimmick21-Nov-03 13:05 
GeneralRe: SOCKADDR_IN structure port conversion Pin
Kuniva22-Nov-03 1:08
Kuniva22-Nov-03 1:08 
GeneralTrimLeft() question Pin
speedpacer21-Nov-03 9:44
speedpacer21-Nov-03 9:44 
GeneralRe: TrimLeft() question Pin
speedpacer21-Nov-03 10:07
speedpacer21-Nov-03 10:07 
GeneralRe: TrimLeft() question Pin
speedpacer21-Nov-03 11:00
speedpacer21-Nov-03 11:00 
GeneralRe: TrimLeft() question Pin
John R. Shaw21-Nov-03 11:24
John R. Shaw21-Nov-03 11:24 
GeneralRe: TrimLeft() question Pin
speedpacer21-Nov-03 12:21
speedpacer21-Nov-03 12:21 
GeneralRe: TrimLeft() question Pin
Mike Dimmick21-Nov-03 13:10
Mike Dimmick21-Nov-03 13:10 
GeneralPrinting and Bitmap Coding. Pin
krondorl21-Nov-03 8:50
krondorl21-Nov-03 8:50 
GeneralRe: Printing and Bitmap Coding. Pin
John R. Shaw21-Nov-03 11:59
John R. Shaw21-Nov-03 11:59 
GeneralRe: Printing and Bitmap Coding. Pin
krondorl22-Nov-03 5:30
krondorl22-Nov-03 5:30 

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.