Printing using ShellExecute without showing the print dialog!

Hello,

Is there any way to print an HTML file using the ShellExecute API but without showing the Windows print dialog?
The ShellExecute will use the associated application (IE) to print the file.
I think that I have read somewhere in MSDN that this is a security issue and that's why the print dialog is shown in IE when printing!
I know how to bypass the print dialog using the web browser control, but I don't want to use the web browser control!

Thank you.
BigBossAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BrianGEFF719Commented:
0
[ fanpages ]IT Services ConsultantCommented:
Hi,

I haven't tried this suggestion, but suspect it would probably work...

The window handle returned from ShellExecute could be used in the SendMessage API in order to force a [RETURN] code (13) to the print dialog window.

[Like a more sophisticated "SendKeys" :)]

BFN,

fp.
0
BigBossAuthor Commented:
BrianGEFF719...did you read my question well?????
I said:
>>I know how to bypass the print dialog using the web browser control, but I don't want to use the web browser control!

fanpages...thank you for your comment. This is just a "workaround" and I suspect that it would work!
The ShellExecute does not return a window handle, rather, it returns a success of failure codes!
Can you provide code, please?

Thank you.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

[ fanpages ]IT Services ConsultantCommented:
Hi,

Sorry, I am confused, "ShellExecute" does return the ProcessID of the invoked executable.

Have you proven otherwise?

BFN,

fp.
0
BigBossAuthor Commented:
fanpages...the ShellExecute return codes are described in Q170918 of MSDN. It does not return any window handle or ProcessID. Probably, you are confusing it with the Shell function.

Thank you.
0
BrianGEFF719Commented:
Why dont you want to use IE?
You dont have to create a "control" on a form, you can do it purly with code.

-Brian
0
[ fanpages ]IT Services ConsultantCommented:
Oh, yes, I meant to type "ShellExecuteEx".
The SHELLEXECUTEINFO Structure's "Handle" item will contain the "ProcessId" information.

Are you familiar with this API call?

I can provide code if you are not.

BFN,

fp.

0
BigBossAuthor Commented:
BrianGEFF719...I am not sure if you can do it without at least adding a reference to your project.
In other words, the question is: Can my application load and its other functions work even if the user does not have IE?... thank you.

fanpages, can you please provide code for the specific task?, i.e. for sending a message to the print dialog that is opend by IE through my application (using ShellExecuteEx). And, if another instance(s) of my application (component) opens another print dialog(s) at the same time, would everything work fine???

Thank you.
0
BrianGEFF719Commented:
First, you can use the IE control entierly by reference, secondly, you are asking fanpages for examples to Open IE?? whats that about, any windows computer will work...because they all come with IE....you dont make sense.


-Brian
0
BrianGEFF719Commented:
I resign from this question....good luck.
0
BigBossAuthor Commented:
BrianGEFF719...thank you for your comment.
What I want to do is to have my application (ActiveX component) to be able to print several types of stuff, including html pages. If the user machine does not have IE installed, I want my component to still function for the other stuff. In addition, if the user machine has another browser, I want the component to be able to print html using that browser.
Now the problem with IE is that if I don't use the browser control to print, but use IE itself, it shows the print dialog, which I don't want.
If I include any references to the browser control or IE itself in my component, as far as I know, it won't load...am I wrong?

I am not sure if the case in clear now!
0
BrianGEFF719Commented:
go to project -> REFERENCES and check off microsoft internet controls


Private WithEvents IEObj As SHDocVw.InternetExplorer

Private Sub Form_Load()
   Set IEObj = New SHDocVw.InternetExplorer
   IEObj.Navigate "c:\yourxmlfile"
End SUb

Private Sub Form_Unload()
   Set IEObj = Nothing
End Sub

Private Sub IEObj_DocumentComplete(...)
   IEObj.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER
   Unload Me
End Sub




You do not have to create a control on a form.

-Brian
0
BigBossAuthor Commented:
Brian...thank you for your comment and for the code.
Are you sure that my compiled component will load on a machine that does not have IE (and shdocvw.dll) installed?
As far as I know, if an application includes a reference that can not be found on the user machine, on load it will popup an error message and will exit!!!
Am I wrong???
I want my other functions in the component to work if the user does not have IE installed.

Thank you.
0
BrianGEFF719Commented:
What i am trying to explain is that all Windows based computers come pre-installed with IE. IE cannot be removed from Windows 95+. The entire operating system is based on IE!!!

-Brian
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BigBossAuthor Commented:
Thanks...
0
BrianGEFF719Commented:
Do you need any further help with this issue?

-Brian
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.