473,785 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent print problem

I'm about to deploy a program that prints out Word documents. However,
due to licensing issues, we don't actaully have Word 2003 or Office
2003 installed on the machine - only the free Word Viewer (Microsoft
Office Word Viewer 2003).

I'm just wondering if the following should be possible, because it
doesn't appear to work:
assuming with have

<code>
public enum ShowCommands : int
{
SW_HIDE = 0,
SW_SHOWNORMAL = 1,
SW_NORMAL = 1,
SW_SHOWMINIMIZE D = 2,
SW_SHOWMAXIMIZE D = 3,
SW_MAXIMIZE = 3,
SW_SHOWNOACTIVA TE = 4,
SW_SHOW = 5,
SW_MINIMIZE = 6,
SW_SHOWMINNOACT IVE = 7,
SW_SHOWNA = 8,
SW_RESTORE = 9,
SW_SHOWDEFAULT = 10,
SW_FORCEMINIMIZ E = 11,
SW_MAX = 11
}

[DllImport("shel l32.dll")]
static extern IntPtr ShellExecute(
IntPtr hwnd,
string lpOperation,
string lpFile,
string lpParameters,
string lpDirectory,
ShowCommands nShowCmd);
</code>

then surely, if I want to print the document to WordView (or whatever
application is registered to '.doc' filetype) I would do the following:

<code>
String sFileToPrint = @"C:\Inetpub\ww wroot\119671.do c";
ShellExecute(In tPtr.Zero, "print", sFileToPrint, "", "",
ShowCommands.SW _SHOW);
</code>

This works fine on a machine with Word 2003 installed, but when I put
it on a machine with just Microsoft Office Word Viewer 2003 on it,
nothing happens.

Any ideas anyone?

Thanks

Dave.

May 3 '06 #1
2 1933
Unfortunately wordview doesn't support shell printing. Nor does it support
command line printing. Nor COM objects. About the only thing it seems
capable of is actually clicking "File->Print".

I've made a kludge that makes it work with keyboard emulation, but honestly
I'm ashamed to even ADMIT that, let alone actually use it :-) Although if
you've found another way around the problem I'd love to hear it.

Jim
"Code Monkey" wrote:
I'm about to deploy a program that prints out Word documents. However,
due to licensing issues, we don't actaully have Word 2003 or Office
2003 installed on the machine - only the free Word Viewer (Microsoft
Office Word Viewer 2003).

I'm just wondering if the following should be possible, because it
doesn't appear to work:
assuming with have

<code>
public enum ShowCommands : int
{
SW_HIDE = 0,
SW_SHOWNORMAL = 1,
SW_NORMAL = 1,
SW_SHOWMINIMIZE D = 2,
SW_SHOWMAXIMIZE D = 3,
SW_MAXIMIZE = 3,
SW_SHOWNOACTIVA TE = 4,
SW_SHOW = 5,
SW_MINIMIZE = 6,
SW_SHOWMINNOACT IVE = 7,
SW_SHOWNA = 8,
SW_RESTORE = 9,
SW_SHOWDEFAULT = 10,
SW_FORCEMINIMIZ E = 11,
SW_MAX = 11
}

[DllImport("shel l32.dll")]
static extern IntPtr ShellExecute(
IntPtr hwnd,
string lpOperation,
string lpFile,
string lpParameters,
string lpDirectory,
ShowCommands nShowCmd);
</code>

then surely, if I want to print the document to WordView (or whatever
application is registered to '.doc' filetype) I would do the following:

<code>
String sFileToPrint = @"C:\Inetpub\ww wroot\119671.do c";
ShellExecute(In tPtr.Zero, "print", sFileToPrint, "", "",
ShowCommands.SW _SHOW);
</code>

This works fine on a machine with Word 2003 installed, but when I put
it on a machine with just Microsoft Office Word Viewer 2003 on it,
nothing happens.

Any ideas anyone?

Thanks

Dave.

May 10 '06 #2
I've had to send keystrokes to wordview because it's the only thing
that seemed to work. Kind of embarassing really! Oh well!

May 15 '06 #3

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

Similar topics

3
2443
by: Rob | last post by:
I have a form - when you click the submit button, it appends a variable to the URL (e.g. xyz.cgi?inputID=some_dynamic_variable) It also opens a new page. Now, that some_dynamic_variable is actually the name of a form element on the parent window. On the new page, I have this javascript: ---- var var2 = location.search.substring(9); document.write(var2)
9
3809
by: Adam Right | last post by:
Hi, I am using .Net Framework 2.0 final, and i use .Net printing library to print a document. I use printPreview dialog to print the document but after preview was shown, when i press the "print" button, i cannot print the document although there is some words on the preview. So, is there a bug in the preview? Thanks...
1
2183
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include <string>
5
3554
by: koonda | last post by:
Hi all, I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can play. The players numbers can fill the board, but I have problem implementing the winner for the...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10090
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.