Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Enterprise Development / July 2008



Tip: Looking for answers? Try searching our database.

ShellExecuteEx Printto

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
amdrit - 10 Jun 2008 15:45 GMT
Hello Everyone.

I have a need to print some PDF documents in the background from my
application.  There are a couple things that aren't clear or my expectation
is too high.

My first issue is that I am only able to get Acrobat to display minimized, I
would prefer it never appeared.  I use the SW_HIDE constant as my value for
SHELLEXECUTEINFO.nShow.

I could live with that if I knew when the printing was complete so that I
could close the application down myself.  This brings me to me second issue,
how do I obtain the windows handle from the hProcess?

My thinking is that I could PostMessage WM_CLOSE after a timeout period get
Acrobat to close up for me.  Perhaps that is the wrong approach, since it is
possible for Acrobat to already be open and the user could have another PDF
file up.

I am looking to simulate the Windows Explorer, Right Click, Print
functionality.  However, I do have some caveats:

1.  I want to specify an alternate printer (this seems to work well).
2.  I want the documents to be printed to spawn a new instance of Acrobat as
to not interfear with existing spawns..
3.  I want Acrobat to go away when the printing is complete.  Currently,
even Explorer leaves one instance open.

ShellInfo.cbSize = Len(ShellInfo)
ShellInfo.lpVerb = strVerb '"printto"
ShellInfo.lpFile = strFileName
ShellInfo.lpParameters = """" & strPrinterUNC & """"
ShellInfo.nShow = SW_HIDE
ShellInfo.fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_FLAG_DDEWAIT

iRet = ShellExecuteEX(ShellInfo)

if (iRet and (ShellInfo.hInstApp > 32)) then

 'Monitor until GetExitCode fails or returns a closed code

 '
 '  Here is where I would like to close Acrobat after some time has elapsed
 '   or perhaps a message is captured
 '   To capture a message though, I need the windows handle
 '     who is hinding the windows handle from me.

 CloseHandle ShellInfo.hProcess

end if

If anyone has any thoughts on this, please share them.
mark.tunnard.jackson@googlemail.com - 11 Jul 2008 18:03 GMT
There are some APIs for controlling the Acrobat Reader through DDE or
ActiveX. It's possible they will allow you to do what you want.

http://www.adobe.com/devnet/acrobat/interapplication.html
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.