Solved

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

Posted on 2007-12-05
4
3,191 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

770 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