> Truckle, Andrew J wrote:
> > My code is already using the /s and that is another reason why it is 
> > interesting that it is still showing messages to the user when it hits 
> > errors.

Ehsan wrote:
> That sounds real strange.  I have used regedit a lot and it 
> definitely does not behave like that?  Can you cut and paste 
> the real code you're using?

BOOL CSoundRotaApp::ImportRegKeyFromFile(CString strFile)
{
        BOOL                    bImported = TRUE;
        CString         strTemp;
        SHELLEXECUTEINFO        se = { 0 };
        
        // build a regedit command line
        //   /s   silent
        //   /i   import
        //
        //
        strTemp.Format( _T(" /s /i \"%s\""), strFile );
        
        // execute
        
        se.cbSize = sizeof( se );
        se.lpFile = _T("regedit");
        se.lpParameters = strTemp;
        se.nShow = SW_SHOWDEFAULT;
        se.fMask = SEE_MASK_NOCLOSEPROCESS;
        ShellExecuteEx( &se );
        
        // wait for process to finish
        if( se.hProcess ) 
        {
                WaitForSingleObject( se.hProcess, INFINITE );
                CloseHandle( se.hProcess );
        }
        
        if( (DWORD)(se.hInstApp) < 33 ) 
        {
                // Thow error
                AfxThrowUserException();
                bImported = FALSE;
        }
        
        return bImported;
}

By taking out the /s atleast the user gets feedback anyway which means I
don't require informing the user of success in the parent method.  Anyway,
see if this is different to what you do.

Andrew


This email and any attached files are confidential and copyright protected. If 
you are not the addressee, any dissemination of this communication is strictly 
prohibited. Unless otherwise expressly agreed in writing, nothing stated in 
this communication shall be legally binding.

_______________________________________________
msvc mailing list
msvc@beginthread.com
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for 
subscription changes, and list archive.

Reply via email to