Solved

accessing word

Posted on 2000-05-02
6
176 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
Comment Utility
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
Comment Utility
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
Comment Utility
Edited text of question.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 3

Accepted Solution

by:
_mb_ earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
mb's comment is most authentic. Because there u have complete control of Word from ur VC++ program.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now