h3x0r
h3x0r

Reputation: 25

MFC C++ Edit Windows Controls in Callback Function

I got stuck at this part of my project. I have a Download dialog which when you double click listcontrol. I create it dynamicly and its use a static pointer to a Class which handles Download/Upload processes at FTP.

Well everything is fine here.

Every download process use a thread in this class.and i post a static callback function(thread functions does not accept non-static functions)

But I want to edit my Windows's controls in this callback function what should i do ?

Thanks in Advance.

Upvotes: 1

Views: 1134

Answers (2)

ScottMcP-MVP
ScottMcP-MVP

Reputation: 10425

See this example of using the PostMessage technique:

http://vcfaq.mvps.org/mfc/12.htm

Upvotes: 0

acraig5075
acraig5075

Reputation: 10756

Pass a parameter to your thread being the m_hWnd of your dialog. Then on completion of the work done by the thread use PostMessage to send a message to the dialog class to handle updating of it's controls.

Upvotes: 1

Related Questions