?
Solved

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

Posted on 2007-12-05
4
Medium Priority
?
3,293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 48

Assisted Solution

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

Assisted Solution

by:jpaulino
jpaulino earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 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…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

762 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