How to read/execute word.exe from C++ project?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lajet
    New Member
    • Nov 2007
    • 6

    How to read/execute word.exe from C++ project?

    I need to read some word file from my c++ project through user interface.
    I'm using dev C++ and FLTK GUI tool kit.
    If any of you have an idea how to read/execute word file from c++ project, please let me know.
    Or if you can recommend some tools/functions that can read the word file, it would also be helpful.
    Thanks much in advance.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Are you talking about a .doc file from Microsoft Word?

    If so, check the Office SDK. There's a bunch of stuff there.

    Comment

    • lajet
      New Member
      • Nov 2007
      • 6

      #3
      Yes. I mean .doc file.
      But how to call/execute from C++ coding?
      Can you expalin in more detail?

      Comment

      • oler1s
        Recognized Expert Contributor
        • Aug 2007
        • 671

        #4
        Your terminology is a bit wonky, so I have to question if you even know what you want. (Executing is the not the same as reading, and word.exe is not the same as a word document file.) You can't execute something that isn't...an executable. Which a doc file isn't.

        With that said, I'll rephrase your question as how can I have my program open and read a word doc file?

        The answer is, reverse engineer Microsoft's proprietary file format and reimplement it. That's why Microsoft can charge whatever huge price they charge for Word. Doc files are a proprietary format, so the only one who can guarantee properly opening those files is Microsoft and their own software. A few others have made importers/exporters for Word documents. They had a lot of resources and money and manpower to deal with the issue.

        So if you get my point, effectively you cannot.

        Comment

        • weaknessforcats
          Recognized Expert Expert
          • Mar 2007
          • 9214

          #5
          True, but the Word SDK has a COM object that you can call from your C++ program - providing it's a Windows application.

          Comment

          • lajet
            New Member
            • Nov 2007
            • 6

            #6
            Can you please write a short sample c++ code to call COM object?
            Or where can i find the examples?
            Thanks.

            Comment

            • oler1s
              Recognized Expert Contributor
              • Aug 2007
              • 671

              #7
              Google is your friend.

              Comment

              • mostafa110
                New Member
                • Oct 2007
                • 6

                #8
                Dear,
                for run word.exe through visual C++ project type below code:

                ShellExecute(Ge tSafeHwnd(),"op en","Word.exe", NULL,NULL,1);

                Be careful this function run programm that installed and be in Widows folder. if you run program or *.exe file that is not installed or in other folder you must determine destination. for example: "D:\\My folder\\Desktop \\Myprogram.exe ", and last argument show window 1=normal and 3 = maximized.
                best regards,

                Comment

                • lajet
                  New Member
                  • Nov 2007
                  • 6

                  #9
                  How about from borland c++?
                  Which command should i use for BC++?
                  I think there is no such command like shellexec in Visual c++.
                  Please advise me.
                  Thanks in advance.

                  Comment

                  • weaknessforcats
                    Recognized Expert Expert
                    • Mar 2007
                    • 9214

                    #10
                    Read http://msdn2.microsoft.com/en-us/library/bb762153.aspx.

                    Comment

                    Working...