ShellExecute and SW_HIDE does not behave as wanted
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
ShellExecute and SW_HIDE does not behave as wanted
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?
- 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
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
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
Re: ShellExecute and SW_HIDE does not behave as wanted
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:
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
Re: ShellExecute and SW_HIDE does not behave as wanted
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.
- 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
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.
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.
Re: ShellExecute and SW_HIDE does not behave as wanted
version 2.0.56.0, dated 09/17/2010.
- 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
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
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