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

C / C++ / MFC

 
QuestionWM_GETTEXT( ).....?how doth it work? Pin
aaadetos10-Dec-04 23:47
aaadetos10-Dec-04 23:47 
AnswerRe: WM_GETTEXT( ).....?how doth it work? Pin
ThatsAlok11-Dec-04 0:32
ThatsAlok11-Dec-04 0:32 
AnswerRe: WM_GETTEXT( ).....?how doth it work? Pin
Ravi Bhavnani11-Dec-04 1:59
professionalRavi Bhavnani11-Dec-04 1:59 
GeneralRe: WM_GETTEXT( ).....?how doth it work? Pin
aaadetos12-Dec-04 9:31
aaadetos12-Dec-04 9:31 
GeneralMultithreading Pin
AslFunky10-Dec-04 23:25
AslFunky10-Dec-04 23:25 
GeneralRe: Multithreading Pin
Gary R. Wheeler11-Dec-04 2:14
Gary R. Wheeler11-Dec-04 2:14 
GeneralRe: Multithreading Pin
AslFunky12-Dec-04 21:23
AslFunky12-Dec-04 21:23 
GeneralRe: Multithreading Pin
Gary R. Wheeler13-Dec-04 4:08
Gary R. Wheeler13-Dec-04 4:08 
AslFunky wrote:
Is it necessary to do my stuff in a worker thread?

That depends on what you need to do. If the process takes a lot of time, you don't want to block the user interface while the process runs. That sort of thing is something you can put in a worker thread.

AslFunky wrote:
I mean, how will this function
UINT threadproc(void* para)
be able to access the members of my class when it is not a member of my class.


I always use something like the following:
class Stuff {
//...
static UINT ThreadStart(LPVOID parameter);
UINT Thread();
};
UINT Stuff::ThreadStart(LPVOID parameter)
{
    Stuff *_this = (Stuff *)parameter;
    return _this->Thread();
}
UINT Stuff::Thread()
{
//...
}
//...
AfxBeginThread(ThreadStart,(LPVOID)this);
The static member function matches the prototype required by AfxBeginThread(). You use the parameter to pass a pointer to an instance of your class. In my example, I passed the this pointer, which means I'm starting the thread from another member function of the class. The function that does the actual work of the thread is called Thread(), and since it is a member function, it can access other members of the Stuff class.



Software Zen: delete this;
GeneralRe: Multithreading Pin
faroqtam11-Dec-04 9:25
faroqtam11-Dec-04 9:25 
GeneralRetrieving Data from a Dialog box Pin
aaadetos10-Dec-04 22:49
aaadetos10-Dec-04 22:49 
GeneralRe: Retrieving Data from a Dialog box Pin
Gary R. Wheeler11-Dec-04 2:18
Gary R. Wheeler11-Dec-04 2:18 
Generalcannot convert parameter 1 from 'ArrayType [7]' to 'int []' Pin
sacoskun10-Dec-04 21:22
sacoskun10-Dec-04 21:22 
GeneralRe: cannot convert parameter 1 from 'ArrayType [7]' to 'int []' Pin
Michael Dunn11-Dec-04 4:52
sitebuilderMichael Dunn11-Dec-04 4:52 
Generaltis abt getting keyboard eventz in a dialog box having many windows in it!!!!! Pin
namaskaaram10-Dec-04 19:21
namaskaaram10-Dec-04 19:21 
GeneralRe: tis abt getting keyboard eventz in a dialog box having many windows in it!!!!! Pin
John R. Shaw10-Dec-04 20:15
John R. Shaw10-Dec-04 20:15 
Generalmouse hooking Pin
Member 52815510-Dec-04 19:13
Member 52815510-Dec-04 19:13 
GeneralRe: mouse hooking Pin
John R. Shaw10-Dec-04 20:46
John R. Shaw10-Dec-04 20:46 
GeneralRe: mouse hooking Pin
Member 52815510-Dec-04 22:02
Member 52815510-Dec-04 22:02 
GeneralRe: mouse hooking Pin
John R. Shaw14-Dec-04 7:35
John R. Shaw14-Dec-04 7:35 
GeneralUpdateresource sample needed Pin
includeh1010-Dec-04 18:02
includeh1010-Dec-04 18:02 
GeneralRe: Updateresource sample needed Pin
John R. Shaw10-Dec-04 18:51
John R. Shaw10-Dec-04 18:51 
GeneralRe: Updateresource sample needed Pin
Gary R. Wheeler11-Dec-04 2:21
Gary R. Wheeler11-Dec-04 2:21 
QuestionMenu not loading???? Pin
ashsri10-Dec-04 16:13
ashsri10-Dec-04 16:13 
AnswerRe: Menu not loading???? Pin
John R. Shaw10-Dec-04 21:19
John R. Shaw10-Dec-04 21:19 
GeneralRe: Menu not loading???? Pin
ashsri11-Dec-04 4:47
ashsri11-Dec-04 4:47 

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.