Urgent print problem

C

Code Monkey

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_SHOWMINIMIZED = 2,
SW_SHOWMAXIMIZED = 3,
SW_MAXIMIZE = 3,
SW_SHOWNOACTIVATE = 4,
SW_SHOW = 5,
SW_MINIMIZE = 6,
SW_SHOWMINNOACTIVE = 7,
SW_SHOWNA = 8,
SW_RESTORE = 9,
SW_SHOWDEFAULT = 10,
SW_FORCEMINIMIZE = 11,
SW_MAX = 11
}

[DllImport("shell32.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\wwwroot\119671.doc";
ShellExecute(IntPtr.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.
 
G

Guest

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
 
C

Code Monkey

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top