Click here to Skip to main content
15,895,799 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCan I export a makefile from Visual Studio? Pin
Aric Wang1-Apr-10 19:04
Aric Wang1-Apr-10 19:04 
QuestionWhat is your point, then? Pin
CPallini2-Apr-10 0:10
mveCPallini2-Apr-10 0:10 
QuestionHow to write a function that calls a secondary thread and returns back to the main thread? Pin
eight1-Apr-10 19:03
eight1-Apr-10 19:03 
QuestionRe: How to write a function that calls a secondary thread and returns back to the main thread? Pin
Adam Roderick J1-Apr-10 19:27
Adam Roderick J1-Apr-10 19:27 
AnswerRe: How to write a function that calls a secondary thread and returns back to the main thread? Pin
Cedric Moonen1-Apr-10 20:22
Cedric Moonen1-Apr-10 20:22 
GeneralRe: How to write a function that calls a secondary thread and returns back to the main thread? Pin
eight1-Apr-10 20:50
eight1-Apr-10 20:50 
QuestionLong SMS in PDU mode not Done. Pin
Le@rner1-Apr-10 18:59
Le@rner1-Apr-10 18:59 
QuestionSuspend ShellExcuteEx Pin
Orion Star1-Apr-10 11:06
Orion Star1-Apr-10 11:06 
I have read through www.flounder.com Asynchronous Process Notification/Worker Thread and Arjay thread articles but I can't figure out how to get the two work together

From Asynchronous Process Notification, I understand to use Afxbeginthread to create a thread to wait for the process to end and post a message.
From Worker Thread and Arjay thread articles, I understand that I can use SuspendThread() and ResumeThread().


void CProcessManagerDlg::OnBnRun()
{
       ptrThread = AfxBeginThread(WaitThread, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);
	ptrThread->m_bAutoDelete = FALSE;
	ptrThread->ResumeThread();
}

void CProcessManagerDlg::OnPause()
{
      ptrThread->SuspendThread(); 
}

UINT WaitThread(void *pParam)
{
   CProcessManagerDlg* pThis= (CProcessManagerDlg*)pParam;	
   HANDLE hProcess = Launch(_T("notepad"));  // Or cmd.exe
  ::WaitForSingleObject(hProcess, INFINITE);
   pThis->PostMessage(UWM_DONE, 0, (LPARAM)hProcess);
}



Press Pause wouldn't do anything. I am guessing WaitForSingleObject is preventing the thread from receiving suspend or resume(which would explain why TerminateThread and PostMessage(WM_QUIT) do not work either). So how would I go about suspending a thread that needs to waitforsingleobject on external process?
AnswerRe: Suspend ShellExcuteEx Pin
Richard Andrew x641-Apr-10 11:13
professionalRichard Andrew x641-Apr-10 11:13 
GeneralRe: Suspend ShellExcuteEx Pin
Orion Star2-Apr-10 4:12
Orion Star2-Apr-10 4:12 
GeneralRe: Suspend ShellExcuteEx Pin
Richard Andrew x642-Apr-10 4:53
professionalRichard Andrew x642-Apr-10 4:53 
GeneralRe: Suspend ShellExcuteEx Pin
Orion Star2-Apr-10 5:12
Orion Star2-Apr-10 5:12 
GeneralRe: Suspend ShellExcuteEx Pin
Richard Andrew x642-Apr-10 5:15
professionalRichard Andrew x642-Apr-10 5:15 
GeneralRe: Suspend ShellExcuteEx Pin
Richard Andrew x642-Apr-10 5:35
professionalRichard Andrew x642-Apr-10 5:35 
GeneralRe: Suspend ShellExcuteExd Pin
Orion Star2-Apr-10 9:53
Orion Star2-Apr-10 9:53 
GeneralRe: Suspend ShellExcuteExd Pin
Richard Andrew x642-Apr-10 9:56
professionalRichard Andrew x642-Apr-10 9:56 
GeneralRe: Suspend ShellExcuteExd Pin
Orion Star2-Apr-10 10:09
Orion Star2-Apr-10 10:09 
GeneralRe: Suspend ShellExcuteEx Pin
Orion Star2-Apr-10 9:45
Orion Star2-Apr-10 9:45 
AnswerRe: Suspend ShellExcuteEx Pin
Adam Roderick J1-Apr-10 19:58
Adam Roderick J1-Apr-10 19:58 
GeneralRe: Suspend ShellExcuteEx Pin
Orion Star2-Apr-10 4:13
Orion Star2-Apr-10 4:13 
GeneralRe: Suspend ShellExcuteEx Pin
Adam Roderick J2-Apr-10 5:11
Adam Roderick J2-Apr-10 5:11 
GeneralRe: Suspend ShellExcuteEx Pin
Orion Star2-Apr-10 9:35
Orion Star2-Apr-10 9:35 
QuestionWindows 7 JumpLists! Pin
Fareed Rizkalla1-Apr-10 8:28
Fareed Rizkalla1-Apr-10 8:28 
QuestionWin32/GDI+ - Using a transparent PNG image as window background Pin
Member 38216201-Apr-10 8:24
Member 38216201-Apr-10 8:24 
AnswerRe: Win32/GDI+ - Using a transparent PNG image as window background Pin
Code-o-mat1-Apr-10 8:52
Code-o-mat1-Apr-10 8:52 

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.