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

C / C++ / MFC

 
GeneralRe: CString::Find problem Pin
ForNow26-Jan-12 19:26
ForNow26-Jan-12 19:26 
AnswerRe: CString::Find problem Pin
«_Superman_»26-Jan-12 18:56
professional«_Superman_»26-Jan-12 18:56 
QuestionMember to pointer as template argument Pin
LionAM25-Jan-12 10:44
LionAM25-Jan-12 10:44 
AnswerRe: Member to pointer as template argument Pin
Albert Holguin25-Jan-12 13:44
professionalAlbert Holguin25-Jan-12 13:44 
AnswerRe: Member to pointer as template argument Pin
«_Superman_»25-Jan-12 16:52
professional«_Superman_»25-Jan-12 16:52 
GeneralRe: Member to pointer as template argument Pin
LionAM25-Jan-12 23:02
LionAM25-Jan-12 23:02 
GeneralRe: Member to pointer as template argument Pin
«_Superman_»26-Jan-12 3:03
professional«_Superman_»26-Jan-12 3:03 
Questionc++ win32, Trouble getting CreateThread and CreateProcess running together Pin
jkirkerx25-Jan-12 8:13
professionaljkirkerx25-Jan-12 8:13 
I'm having trouble either launching the 2 correctly, or getting them to run together, not sure which one.

I want to run a fake progress bar update, and run a program in cmd.exe together at the same time.

This current code runs the CreateProcess, and before I wait for the Process, I create a thread to run the progress program. The process runs, and then the progress program runs when the process is complete. I'm trying to run them simultaneously. I'm not waiting for the progress bar to finish, because it's decorative.

C#
if (CreateProcess( lpFile_Create, szParameters_Create, NULL, NULL, FALSE, CREATE_NO_WINDOW, 0, szWindowsTempDir, &si, &pi) )
    {
        // Allocate memory for thread data.
        PIIS7_INSTALL_PROGRESSDATA pDataArray;
        pDataArray = (PIIS7_INSTALL_PROGRESSDATA) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                sizeof(IIS7_INSTALL_PROGRESSDATA));

        if( pDataArray == NULL )
        {
            // If the array allocation fails, the system is out of memory
            ExitProcess(2);
        }
        else {
            // Populate the Data Array Pointers
            pDataArray->hStatusMessage  = pzStatusMessage;
            pDataArray->hProgressBar = pzProgressBar;

            // Run the Progress Bar Program in the memory available
            hProgressBar = CreateThread( NULL, 0, CA_IIS7_ProgressBar_Install, pDataArray, 0, dwProgressBarID );
        }

        // We have the correct prividges - Wait for process to end
        WaitForSingleObject(pi.hProcess, INFINITE);
        GetExitCodeProcess(pi.hProcess, (unsigned long *)&exitstatus);

        CloseHandle(hProgressBar);
        CloseHandle(pi.hProcess);
        CloseHandle(pi.hThread);

        if(pDataArray != NULL)
        {
            HeapFree(GetProcessHeap(), 0, pDataArray);
            pDataArray = NULL;    // Ensure address is not reused.
        }

AnswerRe: c++ win32, Trouble getting CreateThread and CreateProcess running together Pin
Richard Andrew x6425-Jan-12 9:19
professionalRichard Andrew x6425-Jan-12 9:19 
GeneralRe: c++ win32, Trouble getting CreateThread and CreateProcess running together Pin
jkirkerx25-Jan-12 9:23
professionaljkirkerx25-Jan-12 9:23 
GeneralRe: c++ win32, Trouble getting CreateThread and CreateProcess running together Pin
Richard Andrew x6425-Jan-12 9:26
professionalRichard Andrew x6425-Jan-12 9:26 
GeneralRe: c++ win32, Trouble getting CreateThread and CreateProcess running together Pin
Richard Andrew x6425-Jan-12 9:34
professionalRichard Andrew x6425-Jan-12 9:34 
GeneralRe: c++ win32, Trouble getting CreateThread and CreateProcess running together Pin
jkirkerx25-Jan-12 9:56
professionaljkirkerx25-Jan-12 9:56 
GeneralRe: c++ win32, Trouble getting CreateThread and CreateProcess running together Pin
Richard Andrew x6425-Jan-12 9:59
professionalRichard Andrew x6425-Jan-12 9:59 
GeneralRe: c++ win32, Trouble getting CreateThread and CreateProcess running together Pin
jkirkerx25-Jan-12 10:04
professionaljkirkerx25-Jan-12 10:04 
QuestionRe: c++ win32, Trouble getting CreateThread and CreateProcess running together Pin
CPallini25-Jan-12 10:12
mveCPallini25-Jan-12 10:12 
AnswerRe: c++ win32, Trouble getting CreateThread and CreateProcess running together Pin
jkirkerx25-Jan-12 10:47
professionaljkirkerx25-Jan-12 10:47 
GeneralDone Pin
jkirkerx25-Jan-12 11:28
professionaljkirkerx25-Jan-12 11:28 
QuestionSHFileOperation with SHFILEOPSTRUCT fails when used with vars but works with string literals Pin
bcb_guy25-Jan-12 1:06
bcb_guy25-Jan-12 1:06 
AnswerRe: SHFileOperation with SHFILEOPSTRUCT fails when used with vars but works with string literals Pin
Jochen Arndt25-Jan-12 1:55
professionalJochen Arndt25-Jan-12 1:55 
AnswerRe: SHFileOperation with SHFILEOPSTRUCT fails when used with vars but works with string literals Pin
Richard Andrew x6425-Jan-12 2:06
professionalRichard Andrew x6425-Jan-12 2:06 
AnswerIssue Resolved! (Of Course User Error) Pin
bcb_guy25-Jan-12 17:41
bcb_guy25-Jan-12 17:41 
GeneralRe: Issue Resolved! (Of Course User Error) Pin
Jochen Arndt25-Jan-12 21:20
professionalJochen Arndt25-Jan-12 21:20 
GeneralRe: Issue Resolved! (Of Course User Error) Pin
bcb_guy25-Jan-12 23:29
bcb_guy25-Jan-12 23:29 
GeneralRe: Issue Resolved! (Of Course User Error) Pin
David Crow26-Jan-12 3:06
David Crow26-Jan-12 3:06 

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.