?
Solved

accessing word

Posted on 2000-05-02
6
Medium Priority
?
186 Views
Last Modified: 2013-11-20
Hello i want access MS-Word from VC++.
How Can i do it? please explain detaily

Thanks
0
Comment
Question by:yesnathan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 4

Expert Comment

by:inpras
ID: 2769584
Hi,

To access word u can use either CreateProcess(..)

CreateProcess(
         NULL,
         "C:\\Program Files\\Microsoft Office\\Office\\WINWORD.EXE",
         (LPSECURITY_ATTRIBUTES) NULL,
         (LPSECURITY_ATTRIBUTES) NULL,
         TRUE,
         CREATE_NEW_CONSOLE,
         (LPVOID) NULL,
         (LPTSTR) NULL,
         lpStartupInfo, lpProcessInfo ) ;

Please go through the help for each parameter


OR

WinExec(..) this takes the exe name combined with the file name to be opened initially(if needed) and the style. here is the sample code.

WinExec("C:\\Program Files\\Microsoft Office\\Office\\WINWORD.EXE",SW_MAXIMIZE);

Here i am just opening the word if u want u just put this is a CString and add it up with the file name u want to open initialy.

Hope this helps u out
0
 

Author Comment

by:yesnathan
ID: 2769677
hello inpras

        I want to access the word, i.e)drawing lines,printing information and so on... Do you have any side address???????? or anyother information???
               
0
 

Author Comment

by:yesnathan
ID: 2769687
Edited text of question.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 3

Accepted Solution

by:
_mb_ earned 150 total points
ID: 2769955
Use OLE-Automation to get access to Word. Open the class wizard and create IDispatch classes from the type libraray
'msword8.olb'. You find it on your computer. Then you can start and handle word as you want.
Here is an example, that starts word:

_Application objWordApp;
objWordApp.CreateDispatch("Word.Application");
objWordApp.SetVisible(TRUE);
0
 

Expert Comment

by:raschalk
ID: 2770767
Hi,

Here is an easy solution, which not only starts Word, but also opens the document you want it to:


ShellExecute(0, 0, "word.exe", "document.doc", 0, SW_NORMAL);




--Regards,  Rudy
0
 
LVL 1

Expert Comment

by:majorjohn
ID: 2776229
mb's comment is most authentic. Because there u have complete control of Word from ur VC++ program.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question