Click here to Skip to main content
15,899,825 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CString to float conversion or Vice-Versa. Pin
Graham Shanks11-Jun-08 2:44
Graham Shanks11-Jun-08 2:44 
GeneralRe: CString to float conversion or Vice-Versa. Pin
Le@rner11-Jun-08 2:49
Le@rner11-Jun-08 2:49 
GeneralRe: CString to float conversion or Vice-Versa. Pin
Graham Shanks11-Jun-08 3:02
Graham Shanks11-Jun-08 3:02 
AnswerRe: CString to float conversion or Vice-Versa. Pin
Jijo.Raj11-Jun-08 3:02
Jijo.Raj11-Jun-08 3:02 
AnswerRe: CString to float conversion or Vice-Versa. Pin
KarstenK11-Jun-08 3:55
mveKarstenK11-Jun-08 3:55 
AnswerRe: CString to float conversion or Vice-Versa. Pin
krmed11-Jun-08 4:01
krmed11-Jun-08 4:01 
AnswerRe: CString to float conversion or Vice-Versa. Pin
jhwurmbach11-Jun-08 4:17
jhwurmbach11-Jun-08 4:17 
QuestionGetDlgItem() does not take 1 parameter Pin
Anu_Bala11-Jun-08 2:32
Anu_Bala11-Jun-08 2:32 
AnswerRe: GetDlgItem() does not take 1 parameter Pin
Jijo.Raj11-Jun-08 2:40
Jijo.Raj11-Jun-08 2:40 
AnswerRe: GetDlgItem() does not take 1 parameter Pin
Le@rner11-Jun-08 2:40
Le@rner11-Jun-08 2:40 
AnswerRe: GetDlgItem() does not take 1 parameter Pin
Cedric Moonen11-Jun-08 2:43
Cedric Moonen11-Jun-08 2:43 
AnswerRe: GetDlgItem() does not take 1 parameter Pin
Hamid_RT11-Jun-08 2:56
Hamid_RT11-Jun-08 2:56 
AnswerRe: GetDlgItem() does not take 1 parameter Pin
KarstenK11-Jun-08 3:58
mveKarstenK11-Jun-08 3:58 
QuestionCDC MoveTo(int,int) Pin
subramanyeswari11-Jun-08 1:48
subramanyeswari11-Jun-08 1:48 
AnswerRe: CDC MoveTo(int,int) Pin
CPallini11-Jun-08 1:53
mveCPallini11-Jun-08 1:53 
GeneralRe: CDC MoveTo(int,int) Pin
subramanyeswari11-Jun-08 2:52
subramanyeswari11-Jun-08 2:52 
AnswerRe: CDC MoveTo(int,int) Pin
Jijo.Raj11-Jun-08 1:55
Jijo.Raj11-Jun-08 1:55 
AnswerRe: CDC MoveTo(int,int) Pin
Hamid_RT11-Jun-08 2:04
Hamid_RT11-Jun-08 2:04 
AnswerRe: CDC MoveTo(int,int) Pin
achainard11-Jun-08 2:09
achainard11-Jun-08 2:09 
Questionthreadcreation Pin
Mohanraj D11-Jun-08 1:32
Mohanraj D11-Jun-08 1:32 
AnswerRe: threadcreation Pin
Jijo.Raj11-Jun-08 1:39
Jijo.Raj11-Jun-08 1:39 
GeneralRe: threadcreation Pin
Mohanraj D11-Jun-08 2:22
Mohanraj D11-Jun-08 2:22 
GeneralRe: threadcreation Pin
Jijo.Raj11-Jun-08 2:56
Jijo.Raj11-Jun-08 2:56 
AnswerRe: threadcreation Pin
CPallini11-Jun-08 1:39
mveCPallini11-Jun-08 1:39 
AnswerRe: threadcreation Pin
achainard11-Jun-08 2:02
achainard11-Jun-08 2:02 
Hi,

There's a class call CWinThread (for more information look on msdn).
-> MFC is a good lib only for Graphic User Interface, for the rest to not use it...

Perso i prefere use the win32 version :

// H.
HANDLE m_hThread;
DWORD m_dwThreadId;
static DWORD WINAPI ThreadProc( LPVOID pParam );
inline bool ThreadFuntion ();

// CPP.

xxxxxxx:xxxxxxxx () :
hThread ( NULL )
, m_dwThreadId ( 0 )
{
}

xxxxxx::OnClick ()
{
hThread = CreateThread(
NULL, // default security attributes
0, // use default stack size
ThreadProc, // thread function
this, // argument to thread function
0, // use default creation flags
&dwThreadId ); // returns the thread identifier

....
}

bool xxxxxx::ThreadFuntion ()
{

}

// Static function.
DWORD xxxxxx::ThreadProc ( LPVOID pParam )
{
xxxxxx * pThis = reinterpret_cast<xxxxxx *="">( pParam );

if ( !pThis )
{
return -1;
}

// Call non static function.
if ( !pThis -> ThreadFuntion ())
{
return -1;
}

return 0;
}

Use CriticalSection (InitializeCriticalSection)to secure data Access.
Use Event (CreateEvent) with WaitForMultipleObjects or WaitForSingleObject for synchonysation.
Thinks to release handle ( THread, critical section, event...) when your finised.
Take care to thread and application ending condition.
Do not call GUI object (button, list, edit...) from the thread.

Bye...

...

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.