Click here to Skip to main content
16,004,919 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralChild window can't get focus Pin
TianYang17-Aug-03 15:20
TianYang17-Aug-03 15:20 
GeneralRe: Child window can't get focus Pin
Iain Clarke, Warrior Programmer18-Aug-03 1:12
Iain Clarke, Warrior Programmer18-Aug-03 1:12 
GeneralRe: Child window can't get focus Pin
TianYang18-Aug-03 16:51
TianYang18-Aug-03 16:51 
GeneralData from Printer/Serial Port Pin
Hosam Aly Mahmoud17-Aug-03 12:50
Hosam Aly Mahmoud17-Aug-03 12:50 
GeneralCWinThread and starting a thread from a class function Pin
Kuniva17-Aug-03 9:56
Kuniva17-Aug-03 9:56 
GeneralRe: CWinThread and starting a thread from a class function Pin
Ryan Binns17-Aug-03 15:30
Ryan Binns17-Aug-03 15:30 
GeneralRe: CWinThread and starting a thread from a class function Pin
Mike Ellertson17-Aug-03 16:39
sussMike Ellertson17-Aug-03 16:39 
GeneralRe: CWinThread and starting a thread from a class function Pin
Ryan Binns17-Aug-03 16:56
Ryan Binns17-Aug-03 16:56 
Mike Ellertson wrote:
Do you know of any way to get around the static function requirement?

No, not for threads.

Mike Ellertson wrote:
I can't access other data members that aren't static.

The CreateThread() accepts an lParam value that is passed to the ThreadProc() function. Pass a pointer to the thread object, and then you can access the non-static members through this pointer. You can simply call a non-static function to do all the work if you want to:
class ThreadClass
{
public:
    static LRESULT CALLBACK ThreadProc(LPARAM lParam)
    {
        ThreadClass *pThread = (ThreadClass*)lParam;
        return pThread->NonStaticThreadProc();
    }
    LRESULT NonStaticThreadProc()
    {
        // Do whatever here
        return 0;
    }
};


Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

GeneralRe: CWinThread and starting a thread from a class function Pin
Kuniva18-Aug-03 1:00
Kuniva18-Aug-03 1:00 
GeneralRe: CWinThread and starting a thread from a class function Pin
Ryan Binns18-Aug-03 4:13
Ryan Binns18-Aug-03 4:13 
QuestionWhats the difference? Pin
leppie17-Aug-03 9:13
leppie17-Aug-03 9:13 
AnswerRe: Whats the difference? Pin
User 665817-Aug-03 10:25
User 665817-Aug-03 10:25 
GeneralRe: Whats the difference? Pin
leppie17-Aug-03 10:51
leppie17-Aug-03 10:51 
GeneralRe: Whats the difference? Pin
Michael Dunn17-Aug-03 13:02
sitebuilderMichael Dunn17-Aug-03 13:02 
GeneralRe: Whats the difference? Pin
Hosam Aly Mahmoud17-Aug-03 12:57
Hosam Aly Mahmoud17-Aug-03 12:57 
GeneralRe: Whats the difference? Pin
Bob Stanneveld17-Aug-03 13:24
Bob Stanneveld17-Aug-03 13:24 
GeneralRe: What's the difference? Pin
Hosam Aly Mahmoud17-Aug-03 13:31
Hosam Aly Mahmoud17-Aug-03 13:31 
GeneralRe: What's the difference? Pin
Ryan Binns17-Aug-03 15:37
Ryan Binns17-Aug-03 15:37 
GeneralRe: What's the difference? Pin
Hosam Aly Mahmoud17-Aug-03 17:38
Hosam Aly Mahmoud17-Aug-03 17:38 
GeneralRe: What's the difference? Pin
Ryan Binns17-Aug-03 18:38
Ryan Binns17-Aug-03 18:38 
GeneralRe: What's the difference? Pin
Bob Stanneveld18-Aug-03 7:04
Bob Stanneveld18-Aug-03 7:04 
Questioncarriage return bug in Win32 edit controls? Pin
Jim Crafton17-Aug-03 7:33
Jim Crafton17-Aug-03 7:33 
AnswerRe: carriage return bug in Win32 edit controls? Pin
keeploading17-Aug-03 19:08
keeploading17-Aug-03 19:08 
AnswerRe: carriage return bug in Win32 edit controls? Pin
David Crow18-Aug-03 3:07
David Crow18-Aug-03 3:07 
QuestionProblem with vector or data types convertion? Pin
Vassilis Papoulidis17-Aug-03 7:09
Vassilis Papoulidis17-Aug-03 7:09 

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.