Solved

Visual Basic 6 wait till shellexecute API completes before continuing program execution

Posted on 2007-12-05
4
3,163 Views
Last Modified: 2013-12-25
I am using the ShellExecute API to print   pdf   files.  I want to loop until the shellexecute api has completed sending the print job to the print queue then continue with program execution.   Of course I could put a long delay in the program after the shellexecute line but the size of the print files vary greatly.

Below is the shellexecute function and the line used to call the function.

Private Declare Function ShellExecute Lib "shell32.dll" Alias _
      "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As _
      String, ByVal lpszFile As String, ByVal lpszParams As String, _
      ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long


 PrintDoc = ShellExecute(0, "Print", Fname, " ", " ", SW_HIDE)

0
Comment
Question by:DenverDan
  • 2
  • 2
4 Comments
 
LVL 48

Assisted Solution

by:jpaulino
jpaulino earned 500 total points
ID: 20417846
0
 
LVL 48

Assisted Solution

by:jpaulino
jpaulino earned 500 total points
ID: 20417861
Hummmm!

Also have a look on this wsteegmans proposal http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Controls/Q_20809593.html

It's a nice option.
0
 
LVL 1

Accepted Solution

by:
DenverDan earned 0 total points
ID: 20422670
I reviewed both your suggestions,  the item you suggested "Shell execute print"  was pretty clear that getting process information when printing pdf files is not appropriate.  I will just put a long delay after the shellexecute command before executing a the next lines of code.  Thanks,
0
 
LVL 1

Author Comment

by:DenverDan
ID: 22926102
No Objections
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now