Click here to Skip to main content
15,914,160 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Cannot debug with PDBs Pin
Andy Moore25-Oct-07 6:26
Andy Moore25-Oct-07 6:26 
GeneralRe: Cannot debug with PDBs Pin
indigox326-Oct-07 3:32
indigox326-Oct-07 3:32 
QuestionCStdioFile save location to wrong path [modified] Pin
acerunner31624-Oct-07 9:40
acerunner31624-Oct-07 9:40 
AnswerRe: CStdioFile save location to wrong path Pin
Peter Weyzen24-Oct-07 9:45
Peter Weyzen24-Oct-07 9:45 
Questionwait for CWinThread to terminate -- from UI thread Pin
Peter Weyzen24-Oct-07 9:27
Peter Weyzen24-Oct-07 9:27 
AnswerRe: wait for CWinThread to terminate -- from UI thread Pin
Peter Weyzen24-Oct-07 9:43
Peter Weyzen24-Oct-07 9:43 
AnswerRe: wait for CWinThread to terminate -- from UI thread Pin
pierre_ribery24-Oct-07 10:45
pierre_ribery24-Oct-07 10:45 
AnswerRe: wait for CWinThread to terminate -- from UI thread Pin
JudyL_MD24-Oct-07 10:51
JudyL_MD24-Oct-07 10:51 
That will only work if the thread has a message pump - i.e. is created as a UI thread. If it is a worker thread, I usually do the following (error checking removed for the sake of brevity):

in the main UI thread:

// create worker thread
m_hTermEvent = CreateEvent (NULL, TRUE, FALSE, NULL);
m_pThread = AfxBeginThread (ThreadFunction, &m_hTermEvent);
  
// time to terminate worker thread
SetEvent (m_hTermEvent);
WaitForSingleObject (m_pThread->m_hThread, INFINITE);

in the worker thread:

UINT __cdecl ThreadFunction( LPVOID pParam )
{
    HANDLE hEvent;
  
    hEvent = *((HANDLE *) pParam);
    while (true)
    {
        if WaitForSingleObject (hEvent, 0) == WAIT_OBJECT_0)
            break;
  
        // do your work
    };
    return 0;
}

Judy
GeneralRe: wait for CWinThread to terminate -- from UI thread Pin
pierre_ribery24-Oct-07 10:59
pierre_ribery24-Oct-07 10:59 
GeneralRe: wait for CWinThread to terminate -- from UI thread Pin
JudyL_MD24-Oct-07 11:09
JudyL_MD24-Oct-07 11:09 
GeneralRe: wait for CWinThread to terminate -- from UI thread Pin
Peter Weyzen24-Oct-07 11:18
Peter Weyzen24-Oct-07 11:18 
AnswerRe: wait for CWinThread to terminate -- from UI thread Pin
Mark Salsbery24-Oct-07 12:18
Mark Salsbery24-Oct-07 12:18 
GeneralRe: wait for CWinThread to terminate -- from UI thread Pin
Peter Weyzen24-Oct-07 13:31
Peter Weyzen24-Oct-07 13:31 
GeneralRe: wait for CWinThread to terminate -- from UI thread Pin
Peter Weyzen31-Oct-07 17:49
Peter Weyzen31-Oct-07 17:49 
QuestionProblem!!! Pin
purplee8524-Oct-07 7:00
purplee8524-Oct-07 7:00 
AnswerRe: Problem!!! Pin
led mike24-Oct-07 7:23
led mike24-Oct-07 7:23 
QuestionRe: Problem!!! Pin
David Crow24-Oct-07 7:30
David Crow24-Oct-07 7:30 
AnswerRe: Problem!!! Pin
jhwurmbach24-Oct-07 22:39
jhwurmbach24-Oct-07 22:39 
QuestionCreating a form at runtime Pin
Demian Panello24-Oct-07 6:23
Demian Panello24-Oct-07 6:23 
QuestionUsing ADO or OLE DB with VC++ Pin
Stevej24-Oct-07 5:54
Stevej24-Oct-07 5:54 
AnswerRe: Using ADO or OLE DB with VC++ Pin
led mike24-Oct-07 7:13
led mike24-Oct-07 7:13 
GeneralRe: Using ADO or OLE DB with VC++ Pin
Stevej24-Oct-07 8:12
Stevej24-Oct-07 8:12 
GeneralRe: Using ADO or OLE DB with VC++ [modified] Pin
led mike24-Oct-07 8:49
led mike24-Oct-07 8:49 
AnswerRe: Using ADO or OLE DB with VC++ Pin
DQNOK24-Oct-07 11:02
professionalDQNOK24-Oct-07 11:02 
QuestionHow to change windows desktop appearance through VC++/MFC ? Pin
cagespear24-Oct-07 5:46
cagespear24-Oct-07 5:46 

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.