Click here to Skip to main content
15,890,557 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GetDlgItem(IDC_YourButton)->EnableWindow(true); Pin
Bob Stanneveld10-Jun-05 4:06
Bob Stanneveld10-Jun-05 4:06 
GeneralRe: Disable or Enable a Button Pin
Bob Stanneveld10-Jun-05 4:02
Bob Stanneveld10-Jun-05 4:02 
GeneralWDM -- INF file & makefile Differences between X86 and X86-64/AMD64 Pin
Neha.marwaha10-Jun-05 2:01
Neha.marwaha10-Jun-05 2:01 
GeneralRe: WDM -- INF file & makefile Differences between X86 and X86-64/AMD64 Pin
Alexander M.,10-Jun-05 3:03
Alexander M.,10-Jun-05 3:03 
QuestionIWebBrowser anchor doesn't work? Pin
ThinkingPrometheus10-Jun-05 1:37
ThinkingPrometheus10-Jun-05 1:37 
GeneralUrgent help needed for printing the content of RichEditControl Pin
P. Gnana Prakash10-Jun-05 1:20
P. Gnana Prakash10-Jun-05 1:20 
GeneralQuestion about MultiThreading Pin
Aqueel10-Jun-05 0:51
Aqueel10-Jun-05 0:51 
GeneralRe: Question about MultiThreading Pin
Cedric Moonen10-Jun-05 1:04
Cedric Moonen10-Jun-05 1:04 
The problem is that you pass to AfxBeginThread a member function of a class. This won't work because a member function does't not have the same calling convention as a standard function (the this pointer is passed implicitely).

Thus you need to use a global function. If your thread needs to access some member variables of the class that started the thread, you can pass the pointer to the class in the parameter:

UINT getTime(LPVOID param)<br />
{<br />
CMyThreadDlg* pDlg = (CMyThreadDlg*)param;<br />
<br />
//Do things with pDlg...<br />
<br />
//Don't need to call AfxEndThread because the thread will finish automatically when this function returns<br />
return 0;<br />
}<br />

And to spawn the thread:


void CMyThreadrDlg::OnCreateThread() <br />
{<br />
if (m_check) // if check box is checked<br />
{<br />
CWinThread *pThread = AfxBeginThread(getTime, this);  // pass the this pointer in the argument<br />
}<br />
}<br />


Also, you don't need to call AfxEndThread before leaving the thread function because the thread will automatically finishes when this function exits.
GeneralRe: Question about MultiThreading Pin
Stlan10-Jun-05 1:14
Stlan10-Jun-05 1:14 
GeneralRe: Question about MultiThreading Pin
Cedric Moonen10-Jun-05 2:06
Cedric Moonen10-Jun-05 2:06 
GeneralRe: Question about MultiThreading Pin
Stlan10-Jun-05 2:19
Stlan10-Jun-05 2:19 
GeneralRe: Question about MultiThreading Pin
David Crow10-Jun-05 6:19
David Crow10-Jun-05 6:19 
GeneralConstructing a parser Pin
dittygrail9-Jun-05 23:33
dittygrail9-Jun-05 23:33 
GeneralRe: Constructing a parser Pin
Stlan10-Jun-05 0:11
Stlan10-Jun-05 0:11 
GeneralRe: Constructing a parser Pin
toxcct10-Jun-05 0:24
toxcct10-Jun-05 0:24 
GeneralRe: Constructing a parser Pin
toxcct10-Jun-05 1:31
toxcct10-Jun-05 1:31 
GeneralRe: Constructing a parser Pin
ThatsAlok10-Jun-05 1:41
ThatsAlok10-Jun-05 1:41 
GeneralRe: Constructing a parser Pin
ThatsAlok10-Jun-05 1:35
ThatsAlok10-Jun-05 1:35 
GeneralRe: Constructing a parser Pin
toxcct10-Jun-05 1:49
toxcct10-Jun-05 1:49 
GeneralRe: Constructing a parser Pin
ThatsAlok10-Jun-05 1:54
ThatsAlok10-Jun-05 1:54 
GeneralRe: Constructing a parser Pin
Stlan10-Jun-05 1:58
Stlan10-Jun-05 1:58 
GeneralRe: Constructing a parser Pin
ThatsAlok10-Jun-05 2:04
ThatsAlok10-Jun-05 2:04 
GeneralRe: Constructing a parser Pin
Stlan10-Jun-05 2:22
Stlan10-Jun-05 2:22 
GeneralRe: Constructing a parser Pin
ThatsAlok10-Jun-05 2:25
ThatsAlok10-Jun-05 2:25 
GeneralOT Pin
Bob Stanneveld10-Jun-05 2:44
Bob Stanneveld10-Jun-05 2:44 

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.