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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Open word document on clicking menu

Open word document on clicking menu

Scheduled Pinned Locked Moved C / C++ / MFC
designc++helptutorial
8 Posts 2 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.
  • S Offline
    S Offline
    shir_k
    wrote on last edited by
    #1

    Hi, I have created a User Interface which has a Help Menu in that i have USER Manual as submenu, when i click on User Manual sub menu it has to open an existing word document which contains details of how to use the User Interface. UI has been developed using MS VC++ .Please help me out. Thanks in advance

    enhzflepE 1 Reply Last reply
    0
    • S shir_k

      Hi, I have created a User Interface which has a Help Menu in that i have USER Manual as submenu, when i click on User Manual sub menu it has to open an existing word document which contains details of how to use the User Interface. UI has been developed using MS VC++ .Please help me out. Thanks in advance

      enhzflepE Offline
      enhzflepE Offline
      enhzflep
      wrote on last edited by
      #2

      ShellExecute(NULL, "open", "pathToYourDocFile", NULL, NULL, SW_SHOWNORMAL); See info on parameters here: MSDN: ShellExecute[^]

      S 1 Reply Last reply
      0
      • enhzflepE enhzflep

        ShellExecute(NULL, "open", "pathToYourDocFile", NULL, NULL, SW_SHOWNORMAL); See info on parameters here: MSDN: ShellExecute[^]

        S Offline
        S Offline
        shir_k
        wrote on last edited by
        #3

        Thanks I used the code sent by you but it not opening the document. Below is the code void CNUITApp::OnHelpUsermanual() { ShellExecute(NULL, "open", "C:\\Doc1", NULL, NULL, SW_SHOWNORMAL); // TODO: Add your command handler code here AfxMessageBox(_T("Feature not available gg"),MB_OK|MB_ICONINFORMATION); }

        enhzflepE 1 Reply Last reply
        0
        • S shir_k

          Thanks I used the code sent by you but it not opening the document. Below is the code void CNUITApp::OnHelpUsermanual() { ShellExecute(NULL, "open", "C:\\Doc1", NULL, NULL, SW_SHOWNORMAL); // TODO: Add your command handler code here AfxMessageBox(_T("Feature not available gg"),MB_OK|MB_ICONINFORMATION); }

          enhzflepE Offline
          enhzflepE Offline
          enhzflep
          wrote on last edited by
          #4

          Is your file really called "Doc1" ? I suggest you use the following line: Pre Office 2007

          ShellExecute(NULL, "open", "C:\\Doc1.doc", NULL, NULL, SW_SHOWNORMAL);

          or Office 2007

          ShellExecute(NULL, "open", "C:\\Doc1.docx", NULL, NULL, SW_SHOWNORMAL);

          S 1 Reply Last reply
          0
          • enhzflepE enhzflep

            Is your file really called "Doc1" ? I suggest you use the following line: Pre Office 2007

            ShellExecute(NULL, "open", "C:\\Doc1.doc", NULL, NULL, SW_SHOWNORMAL);

            or Office 2007

            ShellExecute(NULL, "open", "C:\\Doc1.docx", NULL, NULL, SW_SHOWNORMAL);

            S Offline
            S Offline
            shir_k
            wrote on last edited by
            #5

            office 2003 is loaded in the system. I will be giving only the exe to the customer, so we specify the path like this then we need to keep on changing the path where ever the document is copied. How to ovecome with this issue?

            enhzflepE 1 Reply Last reply
            0
            • S shir_k

              office 2003 is loaded in the system. I will be giving only the exe to the customer, so we specify the path like this then we need to keep on changing the path where ever the document is copied. How to ovecome with this issue?

              enhzflepE Offline
              enhzflepE Offline
              enhzflep
              wrote on last edited by
              #6

              Just use a relative path. E.g AppFolder | |--FolderA |--FolderB \--Help if exe is located in AppFolder, and .DOC file is in Help folder:

              ShellExecute(NULL, "open", "Help\\YourFile.doc", NULL, NULL, SW_SHOWNORMAL);

              if exe is located in FolderA, and .DOC file is in AppFolder:

              ShellExecute(NULL, "open", "..\\YourFile.doc", NULL, NULL, SW_SHOWNORMAL);

              S 1 Reply Last reply
              0
              • enhzflepE enhzflep

                Just use a relative path. E.g AppFolder | |--FolderA |--FolderB \--Help if exe is located in AppFolder, and .DOC file is in Help folder:

                ShellExecute(NULL, "open", "Help\\YourFile.doc", NULL, NULL, SW_SHOWNORMAL);

                if exe is located in FolderA, and .DOC file is in AppFolder:

                ShellExecute(NULL, "open", "..\\YourFile.doc", NULL, NULL, SW_SHOWNORMAL);

                S Offline
                S Offline
                shir_k
                wrote on last edited by
                #7

                Thanks u vey much Its working The problem was path of the file Thanks once again

                enhzflepE 1 Reply Last reply
                0
                • S shir_k

                  Thanks u vey much Its working The problem was path of the file Thanks once again

                  enhzflepE Offline
                  enhzflepE Offline
                  enhzflep
                  wrote on last edited by
                  #8

                  Pleasure. :)

                  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