<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>Debenu Quick PDF Library - PDF SDK Community Forum : ShellExec and a bit more (delphi)</title>
  <link>http://www.quickpdf.org/forum/</link>
  <description><![CDATA[This is an XML content feed of; Debenu Quick PDF Library - PDF SDK Community Forum : Sample Code : ShellExec and a bit more (delphi)]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Mon, 11 May 2026 23:20:01 +0000</pubDate>
  <lastBuildDate>Tue, 06 Dec 2005 10:49:22 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 11.01</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.quickpdf.org/forum/RSS_post_feed.asp?TID=139</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Debenu Quick PDF Library - PDF SDK Community Forum]]></title>
   <url>http://www.quickpdf.org/forum/forum_images/QPDF_Forum_Title.png</url>
   <link>http://www.quickpdf.org/forum/</link>
  </image>
  <item>
   <title><![CDATA[ShellExec and a bit more (delphi) : Nice code just wanted to show...]]></title>
   <link>http://www.quickpdf.org/forum/shellexec-and-a-bit-more-delphi_topic139_post622.html#622</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=176">DafCorpX</a><br /><strong>Subject:</strong> 139<br /><strong>Posted:</strong> 06 Dec 05 at 10:49AM<br /><br /><P>Nice code just wanted to show abnother way to open or print the pdf file.</P><P>uses ShellAPI</P><P>ShellExecute( Form1.Handle, 'OPEN', PChar(TheFullPDFFilenameWithPath), nil, nil, sw_shownormal);</P><P><BR>ShellExecute( Form1.Handle, 'PRINT', PChar(TheFullPDFFilenameWithPath), nil, nil, sw_shownormal);</P><P>This will either OPEN the file with it's associated progranm or PRINT it with the same program</P><P>Saves the tedious way to find AcroRead or whatever program that's associated with PDF files.</P><P>Goodluck</P>]]>
   </description>
   <pubDate>Tue, 06 Dec 2005 10:49:22 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/shellexec-and-a-bit-more-delphi_topic139_post622.html#622</guid>
  </item> 
  <item>
   <title><![CDATA[ShellExec and a bit more (delphi) : Often i&amp;#039;ve read questions...]]></title>
   <link>http://www.quickpdf.org/forum/shellexec-and-a-bit-more-delphi_topic139_post406.html#406</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=111">Ingo</a><br /><strong>Subject:</strong> 139<br /><strong>Posted:</strong> 01 Nov 05 at 12:13AM<br /><br />Often i've read questions about how to show/open a pdf-file with QuickPDF. Why you want to do this with QuickPDF? Everybody who's working with pdf-files have installed a pdf-reader... so why not use it? For this you can use ShellExecute or (better) ShellExec ('cause it supports long file names and offers you more features).<br /><br />If you don't want to work with the real name "acrord32" you can use my second example as well. All in Delphi but i think other languages offers the same.<br /><br />Some more special code is "Keybd_Event...". You know pressing the shift-key while opening a pdf-file supress the loading of many dlls (from the acrobat reader) which you often don't need. So in my code first i simulate a pressed shift key and after ShellExec i simulate a released shift key.<br /><br />Best regards,<br />Ingo<br /><br />. . .<br />&nbsp;&nbsp;&nbsp;uses ShellAPI<br />. . .<br />function ShellExec( op, fn, par, dir: PChar;<br />show: Word; wait: Boolean): LongInt;<br />var<br />ih: Word;<br />OK: Boolean;<br />Info: TShellExecuteInfo;<br />begin<br />FillChar(Info, SizeOf(Info), Chr(0));<br />Info.cbSize := SizeOf(Info);<br />Info.fMask := SEE_MASK_NOCLOSEPROCESS;<br />Info.lpVerb := op;<br />Info.lpFile := fn;<br />Info.lpParameters := par;<br />Info.lpDirectory := dir;<br />Info.nShow := show;<br />OK := Boolean(ShellExecuteEx(@Info));<br />if OK then<br />begin<br />if wait then<br />begin<br />while<br />WaitForSingleObject(Info.hProcess,100)<br />= WAIT_TIMEOUT do<br />Application.ProcessMessages;<br />OK := GetExitCodeProcess(<br />Info.hProcess, DWord(Result));<br />end<br />else<br />Result := 0;<br />end;<br />if not OK then Result := -1;<br />end;<br />. . .<br />// Anywhere in your program ... perhaps at an onclick-event:<br />. . .<br />&nbsp;&nbsp;&nbsp;Keybd_Event(vk_Shift,0,0,0);<br />&nbsp;&nbsp;&nbsp;ShellExec('open',PChar('acrord32.exe'),PChar('/s ' + ExtractFilePath(Application.ExeName) + 'example.pdf'),nil,SW_SHOWNORMAL,True);<br />&nbsp;&nbsp;&nbsp;Keybd_Event(vk_Shift,0,KEYEVENTF_KEYUP,0);<br /><br />// and a second solution...<br /><br />. . .<br />ShellExec('open',PChar(GetProgramAssociation('pdf')),PChar('/s ' + ExtractFilePath(Application.ExeName) + 'example.pdf'),nil,SW_SHOWNORMAL,True);<br />. . .<br /><span style="font-size:10px"><br /><br />Edited by Ingo</span>]]>
   </description>
   <pubDate>Tue, 01 Nov 2005 00:13:45 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/shellexec-and-a-bit-more-delphi_topic139_post406.html#406</guid>
  </item> 
 </channel>
</rss>