Click to See Complete Forum and Search --> : Printing


AnesNuno
October 4th, 2001, 09:04 AM
i need to print a emf file

Clearcode
October 4th, 2001, 09:12 AM
You could try...

\\ Declaration

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (byval hwnd as Long, byval lpOperation as string, byval lpFile as string, byval lpParameters as string, byval lpDirectory as string, byval nShowCmd as Long) as Long




Using this API call and passing "Print" in the lpOperation parameter causes windows to print out the document using whichever application is associated with that document. The code to use this from a VB form is:


public Sub PrintDocument(byval sDocumentName as string)
Const SW_HIDE = 0
Dim lRet as Long
lRet = ShellExecute(me.hWnd, "print", sDocumentName, "","",SW_HIDE)
End Sub




If ShellExecute is successful, the return value (lRet) will be greater than 32.

HTH,
D.


-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.

Cimperiali
October 4th, 2001, 09:16 AM
...you know what: I am out of votes...
<Excelent!>
:wink

Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater