473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Running word but in Background

I have made an application in which I want to take a printout of a word
document after changing some bookmarks in it. The issue is I dont want
ot make it apparent ot the user that Microsoft Word has opened up.

Word.Application word = new Word.Application();
word.Visible = true;
word.Activate();

And it doesn't activate window until you make it visible.
Can somebody tell a work-around?

Thanks

Regards

Aug 2 '06 #1
4 3301

ah*********@gmail.com wrote:
I have made an application in which I want to take a printout of a word
document after changing some bookmarks in it. The issue is I dont want
ot make it apparent ot the user that Microsoft Word has opened up.

Word.Application word = new Word.Application();
word.Visible = true;
word.Activate();

And it doesn't activate window until you make it visible.
Can somebody tell a work-around?
I'm not quite clear on what the problem is. You say you don't want the
user to know Word has opened, but you want it active? Just setting
visible to false will "hide" the Word window, and then you can do
whatever
you want (i.e. create a document, print it, whatever).

Matt

Aug 2 '06 #2
That's the problem Matt, you somehow can't activate it until you make
it visible. Setting visible to false gives you an error.

Thanks for helping out

Aug 3 '06 #3
So why do you need to activate it? Is there a reason for this? You should be
able to use the object model (loading a document, printing etc) without
forcing the app into focus...

Marc
Aug 3 '06 #4
Well found a work around....set the form to full screen size. Set its
property this.topMost to true. And hid the taskbar which gave a clean
UI not showing a sign of MS Word

Well for anybody's interest here is how you hide the windows taskbar:

---------------------------------------------------------------------------
//Define inside the class
[DllImport("User32")]
public static extern int ShowWindow(int hwnd, int nCmdShow);

[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string
lpWindowName);

private const int SW_HIDE = 0;
private const int SW_SHOWNA = 8;

public void Foo()
{
ShowWindow(FindWindow("Shell_TrayWnd", "").ToInt32(), SW_HIDE);

this.TopMost = true; //Runs only if function belongs to a form class

//Form is on top of all apps running now, with the taskbar now
completely hidden

//To show Windows taskbar again
ShowWindow(FindWindow("Shell_TrayWnd", "").ToInt32(), SW_SHOWNA);
}

-------------------------------------------------------------------

Hope this helps someone.

Regards

Aug 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Manoj | last post by:
Hi, I want to know if it is possible to find out through a vb.net application which other applications are running in the background.For example as soon as i load my form I want it to check if a...
2
by: David Olive | last post by:
Hi guys, I'm having a bit of a problem getting a VB .NET console app to run happily as a scheduled task. The app itself generates a bunch of word documents on a file share on another server by...
1
by: Ronny Sigo | last post by:
Hello all, I want to create a new word document from VBA (Access). All goes well, except that I also want to establish a background programmatically. So I made a macro is MS WORD, to see how it's...
3
by: IMS.Rushikesh | last post by:
Hi Friends, I am having a problem to set a background color of any selected Word in MS-Word. Only few default (nearly 16 colors) are allow to set as Background color in MS-Word. But i want to...
0
by: morph2007 | last post by:
Hi, I have my resume in good old HTML with Tables and CSS. I have two stylesheets, one to format for the web and the other for when I load the resume up into word - all works fine. Now - I...
0
by: vandervelde | last post by:
Hi, A couple of machines in the office have recently upgraded to word 2003 and the printing macros for these machines are working intermittently. The macro takes the computer name and a printer...
8
by: Ravi | last post by:
Hi to all, There is a start button in my page. if user clicks on that then a php program should start and should listen on a particular port. and also user should able to do other tasks on...
1
by: nassersh | last post by:
I am using a bound control to embed word documents within an access form. I have created two buttons on the form One to embed aand display and one to close. I embed one doc and then save the doc...
0
by: Ang | last post by:
Hi, I want to open a word file on background instead of showing the process on client's screen. And then do mailmerge, after that allow user to saveas. (user simply click the button and IE will...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.