Solved

VB6: Need to print photoshop files in a batch using the default printer.

Posted on 2004-10-12
4
148 Views
Last Modified: 2011-08-18
I need to print a bunch of photoshop files I generated using the photoshop APIs.  All that is done, i just don't know how to do the printing and since it will be large batches it would be a sweet feature to automate.

What code can I use to do such a thing?  Photoshop is the default handler for the .psd files.  I am okay with using the defualt printer if that greatly simplifies things.  Any help?
0
Comment
Question by:Brothernod
  • 2
4 Comments
 
LVL 1

Author Comment

by:Brothernod
ID: 12294853
Is it really different from printing any other file type with the default application?
0
 
LVL 1

Author Comment

by:Brothernod
ID: 12319814
Well I raised the point value in an attempt of getting interest in my topic.  I've seen printing questions answered when i did a search so I don't understand why i'm not getting any attention for my small nuance.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 12354367
Hi, Brothernod.

I don't have access to Photoshop so I've no way to test the code below.  The code sample here uses the ShellExecute API function to print the document name passed.  This approach works fine with Word and various other file types, it invokes the default application based on the file extension, but it apparently doesn't work for all file types.  I don't know about Photoshop files.  You'll need to edit the code and change PathToPSDFile to the fully qualified path and name of a PSD file to test against.

Here are links to more information on the ShellExecute command in case you're interested.
1.  http://www.vb-helper.com/howto_shellexecute.html
2.  http://support.microsoft.com/kb/q170918/
3.  http://www.wincron.com/trflpcshellexecute.html

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

Private Sub Command1_Click()
    Dim lngResult As Long
    lngResult = ShellExecute(Me.hwnd, "print", "PathToPSDFile", "", "", SW_HIDE)
End Sub
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

708 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

16 Experts available now in Live!

Get 1:1 Help Now