Click here to Skip to main content
15,898,957 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCreating Formatting Bar Pin
.NET- India 3-Aug-07 9:23
.NET- India 3-Aug-07 9:23 
QuestionRe: Creating Formatting Bar Pin
David Crow3-Aug-07 10:35
David Crow3-Aug-07 10:35 
AnswerRe: Creating Formatting Bar Pin
Hamid_RT3-Aug-07 18:44
Hamid_RT3-Aug-07 18:44 
QuestionCreate a wav file using existing wav files Pin
vikrant kpr3-Aug-07 7:56
vikrant kpr3-Aug-07 7:56 
AnswerRe: Create a wav file using existing wav files Pin
mid=57413-Aug-07 17:07
mid=57413-Aug-07 17:07 
AnswerRe: Create a wav file using existing wav files Pin
Karismatic3-Aug-07 20:38
Karismatic3-Aug-07 20:38 
QuestionAfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 5:59
Johpoke3-Aug-07 5:59 
AnswerRe: AfxBeginThread() with a function in the main class Pin
led mike3-Aug-07 6:13
led mike3-Aug-07 6:13 
Well this is not a MFC thread but it can work in MFC applications and/or maybe it will help give you the idea

/** Win32 CreateThread class wrapper */
class base_w32thread{
protected:
    HANDLE    _handle;
    DWORD    _dwTID;
    base_w32thread():_handle(0), _dwTID(0L){}
    virtual ~base_w32thread()=0;

public:
    bool start(LPSECURITY_ATTRIBUTES psecattrs = NULL, DWORD dwCreateFlags = 0L);
    operator HANDLE(){ return _handle; }
protected:
    virtual void run()=0;
    virtual void onEndThread(){}
    static long WINAPI threadfnc( LPARAM lp);
};

#include "StdAfx.h"

#include "base_w32thread.h"
#include <winbase.h>
#include <assert.h>

base_w32thread::~base_w32thread(){}

/** start the thread */
bool base_w32thread::start(LPSECURITY_ATTRIBUTES psecattrs, DWORD dwCreateFlags){

    assert( !_handle);
    if( _handle)
        return false;

    _handle = ::CreateThread( psecattrs, 0, 
        (LPTHREAD_START_ROUTINE)threadfnc, this, dwCreateFlags, &_dwTID);
    return (_handle)?true:false;
}
/** Thread function */
long WINAPI base_w32thread::threadfnc( LPARAM lp){

    assert( lp);
    base_w32thread* pThis = (base_w32thread*)lp;
    if( pThis)
        pThis->run();

    pThis->_handle = 0L;        // thread exited
    pThis->onEndThread();
    return 0L;
}




QuestionRe: AfxBeginThread() with a function in the main class Pin
David Crow3-Aug-07 6:15
David Crow3-Aug-07 6:15 
AnswerRe: AfxBeginThread() with a function in the main class [modified] Pin
Mark Salsbery3-Aug-07 6:20
Mark Salsbery3-Aug-07 6:20 
QuestionRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 6:39
Johpoke3-Aug-07 6:39 
AnswerRe: AfxBeginThread() with a function in the main class Pin
Mark Salsbery3-Aug-07 6:45
Mark Salsbery3-Aug-07 6:45 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 6:52
Johpoke3-Aug-07 6:52 
QuestionRe: AfxBeginThread() with a function in the main class Pin
David Crow3-Aug-07 6:54
David Crow3-Aug-07 6:54 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 6:59
Johpoke3-Aug-07 6:59 
QuestionRe: AfxBeginThread() with a function in the main class Pin
David Crow3-Aug-07 7:05
David Crow3-Aug-07 7:05 
AnswerRe: AfxBeginThread() with a function in the main class [Solved] Pin
Johpoke3-Aug-07 7:12
Johpoke3-Aug-07 7:12 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Ahmad Al-Maraghi4-Aug-07 1:50
Ahmad Al-Maraghi4-Aug-07 1:50 
AnswerRe: AfxBeginThread() with a function in the main class Pin
led mike3-Aug-07 7:08
led mike3-Aug-07 7:08 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Mark Salsbery3-Aug-07 7:32
Mark Salsbery3-Aug-07 7:32 
GeneralRe: AfxBeginThread() with a function in the main class Pin
led mike3-Aug-07 7:43
led mike3-Aug-07 7:43 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 7:59
Johpoke3-Aug-07 7:59 
GeneralRe: AfxBeginThread() with a function in the main class Pin
led mike3-Aug-07 8:09
led mike3-Aug-07 8:09 
GeneralRe: AfxBeginThread() with a function in the main class Pin
Mark Salsbery3-Aug-07 8:14
Mark Salsbery3-Aug-07 8:14 
QuestionRe: AfxBeginThread() with a function in the main class Pin
Johpoke3-Aug-07 8:27
Johpoke3-Aug-07 8:27 

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.