Click here to Skip to main content
15,909,193 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: changing a part of a string Pin
ThatsAlok14-Apr-05 19:34
ThatsAlok14-Apr-05 19:34 
GeneralRe: changing a part of a string Pin
Green Fuze14-Apr-05 23:44
Green Fuze14-Apr-05 23:44 
GeneralRe: changing a part of a string Pin
ThatsAlok15-Apr-05 18:07
ThatsAlok15-Apr-05 18:07 
GeneralRe: changing a part of a string Pin
ng kok chuan17-Apr-05 15:46
ng kok chuan17-Apr-05 15:46 
GeneralRe: changing a part of a string Pin
ThatsAlok20-Apr-05 19:55
ThatsAlok20-Apr-05 19:55 
GeneralThreads Pin
ww303114-Apr-05 12:02
ww303114-Apr-05 12:02 
GeneralRe: Threads Pin
Graham Bradshaw14-Apr-05 12:22
Graham Bradshaw14-Apr-05 12:22 
GeneralRe: Threads Pin
Joel Holdsworth14-Apr-05 12:33
Joel Holdsworth14-Apr-05 12:33 
I'm just writing to back up that other answer. It's true you do need to delcare static. Sometimes though, that can be a problem becuase you want to access member variables and functions back in CMyClass. Here's a good way to get what you want here, I think:
class CMyClass : public CDialog
{
public:
HANDLE thread_handle;
DWORD thread_id;
static UINT ThreadStartFunc(LPVOID data);
UINT ThreadFunc();
// other things
}
and then...
thread_handle = AfxBeginThread(ThreadStartFunc, (LPVOID)this);
then later:
UINT CMyClass::ThreadStartFunc(LPVOID data)
{
ASSERT(data != NULL);
return ((CMyClass*)data)->ThreadFunc();
}

UINT CMyClass::ThreadFunc()
{
// Now you're running a thread back in the context of your initial object
return 0;
}
I don't know if that helps at all.

Joel Holdsworth

Wanna give me a job this summer?
Check out my online CV and project history[^]
GeneralRe: Threads Pin
ww303114-Apr-05 13:03
ww303114-Apr-05 13:03 
GeneralRe: Threads Pin
22491714-Apr-05 18:02
22491714-Apr-05 18:02 
GeneralRe: Threads Pin
22491714-Apr-05 18:00
22491714-Apr-05 18:00 
GeneralRe: Threads Pin
Joel Holdsworth14-Apr-05 23:21
Joel Holdsworth14-Apr-05 23:21 
GeneralRe: Threads Pin
22491714-Apr-05 23:29
22491714-Apr-05 23:29 
GeneralRe: Threads Pin
David Crow15-Apr-05 3:57
David Crow15-Apr-05 3:57 
GeneralVisual Studio 6.0 bug Pin
glowskull0314-Apr-05 11:27
glowskull0314-Apr-05 11:27 
GeneralRe: Visual Studio 6.0 bug Pin
Anonymous14-Apr-05 16:21
Anonymous14-Apr-05 16:21 
GeneralRe: Visual Studio 6.0 bug Pin
ng kok chuan14-Apr-05 16:41
ng kok chuan14-Apr-05 16:41 
QuestionHow to copy folders? Pin
elephantstar14-Apr-05 11:24
elephantstar14-Apr-05 11:24 
AnswerRe: How to copy folders? Pin
Jack Puppy14-Apr-05 13:11
Jack Puppy14-Apr-05 13:11 
AnswerRe: How to copy folders? Pin
22491714-Apr-05 19:12
22491714-Apr-05 19:12 
Generalauto start program Pin
_tasleem14-Apr-05 10:42
_tasleem14-Apr-05 10:42 
GeneralRe: auto start program Pin
mark novak14-Apr-05 11:41
mark novak14-Apr-05 11:41 
GeneralRe: auto start program Pin
22491714-Apr-05 17:49
22491714-Apr-05 17:49 
GeneralAutoscroll a listbox Pin
Anonymous14-Apr-05 10:15
Anonymous14-Apr-05 10:15 
GeneralRe: Autoscroll a listbox Pin
Anonymous14-Apr-05 10:23
Anonymous14-Apr-05 10:23 

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.