ShellExecute and SW_HIDE does not behave as wanted

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
gpxi
User
Posts: 37
Joined: Mon Aug 23, 2010 6:41 am

ShellExecute and SW_HIDE does not behave as wanted

Post by gpxi »

I am using the driver API (the latest version V4 under VB6) to convert or "printto" a .doc file to pdf. I do not want the user to see Word popping up and showing the printing process. So I used the flag SW_HIDE (0) in the ShellExecute command line. However, MS Word seems to ignore my command. Why? Is there a way to accomplish what I am trying to do here?
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17906
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: ShellExecute and SW_HIDE does not behave as wanted

Post by Tracker Supp-Stefan »

Hello gpxi,

As discussed in this topic:
https://forum.pdf-xchange.com/ ... =43&t=8110
You should be able to use automation rather than ShellExecute to print your word documents silently.

Best,
Stefan
gpxi
User
Posts: 37
Joined: Mon Aug 23, 2010 6:41 am

Re: ShellExecute and SW_HIDE does not behave as wanted

Post by gpxi »

Well, actually I started with the automation method. It worked fine with opening up the first document. But the second one crashes the program with an automation error. That's why I switched to the drirver API approach.
Any idea why I got the automation error? Here is the code segment:

Code: Select all

    Dim WordApp As Object
    On Error GoTo errHandler

    Set WordApp = CreateObject("Word.Application")
    WordApp.Documents.Open strFileName
    WordApp.ActiveDocument.content.Copy

    strRTFstring = Clipboard.GetText(vbCFRTF)

    WordApp.Application.Quit
    Set WordApp = Nothing

errHandler:
    Set WordApp = Nothing
    MsgBox "Error openning Word Document", vbCritical
gpxi
User
Posts: 37
Joined: Mon Aug 23, 2010 6:41 am

Re: ShellExecute and SW_HIDE does not behave as wanted

Post by gpxi »

Just to clarify what I did with my project, I used the automation to open a word document and convert it to rtf string and saved it to a temp file. I then used the viewer to import the rtf file. Like I said, it worked fine with the first document, but the operations after that crashed the program, almost everytime. Thanks again.
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: ShellExecute and SW_HIDE does not behave as wanted

Post by Ivan - Tracker Software »

Can you say the version of the viewer used ?
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
gpxi
User
Posts: 37
Joined: Mon Aug 23, 2010 6:41 am

Re: ShellExecute and SW_HIDE does not behave as wanted

Post by gpxi »

version 2.0.56.0, dated 09/17/2010.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17906
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: ShellExecute and SW_HIDE does not behave as wanted

Post by Tracker Supp-Stefan »

Hello gpxi,

Can you please try with the latest build 2.0.57 - just to be sure it's not an issue already fixed in the latest build.

Best,
Stefan
Post Reply