Return to Snippet

Revision: 12704
at March 25, 2009 12:09 by jimfred


Initial Code
// Browse for OCX and then execute Regsvr32
   
   // http://www.functionx.com/visualc/controls/filedialog.htm
   CFileDialog fileDlg(
      true,   // open
	   NULL,
	   NULL,
	   OFN_FILEMUSTEXIST,
	   "OCX Files (*.ocx)|*.ocx|All Files (*.*)|*.*||",
	   this );
   
   bool bOk = fileDlg.DoModal() == IDOK ;

   if ( bOk  )
	{
      CString pathName = fileDlg.GetPathName();

      ShellExecute( // WinExec is obsolete.
         this->m_hWnd,    // hwnd
         "open",          // operation/verb.
         "regsvr32.exe",  // executable.
         pathName,        // parameters.
         NULL,            // directory
         SW_SHOW );       // how to be displayed 

	}

Initial URL

                                

Initial Description

                                

Initial Title
MFC, Open File dialog and shellExecute for regsvr32

Initial Tags

                                

Initial Language
C++