?
Solved

accessing word

Posted on 2000-05-02
6
Medium Priority
?
185 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
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

 
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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

801 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