Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Opening other application from our own application

Opening other application from our own application

Scheduled Pinned Locked Moved C / C++ / MFC
linuxhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Katamneni
    wrote on last edited by
    #1

    Dear All I want to write a dialog based application where user is prompted to choose some file using CFileDialog. I have to open the file selected by the user with default Shell editor associated with that file from my application ( For e.g, if user selecets "Sample.bmp", i must be able to run "mspaint.exe" application with "sample.bmp" opened for editing from my application ) and i must not allow user not to do any operation with my application till he closes the opened application. Can somebody help me in implementing this functionality. Thanks in advance Regards Krishna

    C C 2 Replies Last reply
    0
    • K Katamneni

      Dear All I want to write a dialog based application where user is prompted to choose some file using CFileDialog. I have to open the file selected by the user with default Shell editor associated with that file from my application ( For e.g, if user selecets "Sample.bmp", i must be able to run "mspaint.exe" application with "sample.bmp" opened for editing from my application ) and i must not allow user not to do any operation with my application till he closes the opened application. Can somebody help me in implementing this functionality. Thanks in advance Regards Krishna

      C Offline
      C Offline
      Cool Ju
      wrote on last edited by
      #2

      Hi, you can use ShellExecuteEx() and the use the handle to the created process returned by it to check its existence. Bye, Cool Ju :cool: Dream Ur Destiny -- modified at 4:07 Friday 10th February, 2006

      1 Reply Last reply
      0
      • K Katamneni

        Dear All I want to write a dialog based application where user is prompted to choose some file using CFileDialog. I have to open the file selected by the user with default Shell editor associated with that file from my application ( For e.g, if user selecets "Sample.bmp", i must be able to run "mspaint.exe" application with "sample.bmp" opened for editing from my application ) and i must not allow user not to do any operation with my application till he closes the opened application. Can somebody help me in implementing this functionality. Thanks in advance Regards Krishna

        C Offline
        C Offline
        csc
        wrote on last edited by
        #3

        Try this : CString csCommand = "C:\\WINDOWS\\system32\\mspaint.exe c:\somewhere\sample.bmp"; DoExecCommand( csCommand, TRUE ); BOOL CMyDialog::DoExecCommand( CString csCommand, BOOL bWait ) { STARTUPINFO si; ::ZeroMemory(&si, sizeof si); PROCESS_INFORMATION pi; ::ZeroMemory(&pi, sizeof pi); char* pszCmd = csCommand.GetBuffer(0); BOOL bResult = CreateProcess( NULL, // pointer to name of executable module pszCmd, // pointer to command line string NULL, // process security attributes NULL, // thread security attributes FALSE, // handle inheritance flag NORMAL_PRIORITY_CLASS, // creation flags NULL, // pointer to new environment block NULL, // pointer to current directory name &si, // pointer to STARTUPINFO &pi // pointer to PROCESS_INFORMATION ); if(bResult) { if(bWait) { DWORD dwResult = WaitForSingleObject( pi.hProcess, INFINITE ); } CloseHandle( pi.hProcess ); } return( bResult ); }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups