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
Solved

accessing word

Posted on 2000-05-02
6
182 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
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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Accepted Solution

by:
_mb_ earned 50 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

789 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