Microsoft Word opening and sending info to

I am extremely new to C++ and have not tried anything in Windows yet. I am in the army and think I figured out a way to make our work more streamlined but I don't know enough to write the code. Basically what I need to know how to do is have the compiler ask me to input data then open microsoft word and output the data in a certain text size and font. Not sure how to get the compiler to open microsoft word (or if it is possible). Any help on this would be greatly appreciated.
In VS C++, you are able to open almost any application through you program using ShellExecute, and of course input data.
here is an example using Shellexecute:
search on codeproject.com for more information:
1
2
3
4
5
6
7
8
		 ShellExecute(
			NULL,
			_T("runas"), // Trick for requesting elevation, this is a verb not listed in the documentation above.                                                                 
			_T("winword.exe"),
			NULL, // params
			NULL, // directory
			SW_SHOW);

Awesome thank you. So now where would I enter the text into such as a prompt for info and then the info, would I need the info prior or is this going to bring up the prompt in Word as well? I guess I am asking if you can give me a small example if it isn't too much trouble.
How large is the text?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
anyway, you can save the text to a file on hard disk, then you can open the file in word
with your program
lets say, your file name is test.doc which you stored entered text in your promt.
then you can open the file like this:


#include <Windows.h>
#include <stdio.h>
int main()
{

/************************************************************************/
/*  here should be your code which saving your text into a file                                                                     */
/************************************************************************/


	::ShellExecute()
		NULL,
		_T("open"), // Trick for requesting elevation, this is a verb not listed    in the documentation above.                                                                 
		_T("test.doc"),                                                                                       
		NULL, // params
		NULL, // directory
		SW_SHOW);


}

Last edited on
Topic archived. No new replies allowed.