Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a BMP image through program (coding)

Status
Not open for further replies.

sridhar412

IS-IT--Management
Jun 4, 2002
19
0
0
IN
Hi,

I am working on a layout printing (with BMP image),where
the position of content printing is defined by the user.

As i am not using the report designer (due to user definable layout), i need to print the content through program.

I am unable to print the BMP image through program.

Would appreciate any input.

Sridhar


 
sridhar412

You would need the WinAPI call ShellExecute() and the following code will need modifying to suit.

LOCAL lcFilename ,;
[tab]lcSelected ,;
[tab]lnResult ,;
[tab]lnTotal

DECLARE INTEGER ShellExecute IN SHELL32.dll;
[tab]INTEGER nWinHandle,;
[tab]STRING cOperation,;
[tab]STRING cFileName,;
[tab]STRING cParameters,;
[tab]STRING cDirectory,;
[tab]INTEGER nShowWindow

* Retrieve the main VFP window handle (this handle is used by ShellExecute)
DECLARE INTEGER FindWindow IN WIN32API ;
[tab]STRING cNull,;
[tab]STRING cWinName * Establish filename

lcFileName = [C:\myfiles\index.html] + CHR(0) && Clear old value

lnResult = ShellExecute(FindWindow(;
[tab]0,;
[tab]_SCREEN.caption),;
[tab][Print],;
[tab]lcFilename,;
[tab][],;
[tab][],;
[tab]0)

IF lnResult < 32 && Error messages if the return value is < 32
[tab]wait wind [error]
[tab]* API_ERROR(lnResult)
ENDI

This will print the file through the default Windows printer - you will not be able to select that through VFP.

HTH

Chris [pc2]
 
ChrisRChamberlain:

Although I believe we are writing sridhar412's program and getting them out of a bind, I think they are trying to perform page layout.

The ShellExecute method may definitely be the way to get the document out after it's been constructed.

Sridhar412! We're going to start charging you :)

Darrell
'We all must do the hard bits so when we get bit we know where to bite' :)
 
darrellblackhawk

That post was made before the complexities of what sridhar412 is trying to achieve became obvious.

ShellExecute() can only print the image file as is - I suspect he will need a user modifable report to achieve the result he needs. HTH

Chris [pc2]
 
Guys, start charging me after i finish with my project!!!

I need to print the visitor pass with definable layouts.
I have generated the form dynamically, including validation - thanks to you all..

Now, i have to print the form.

What i have tried till now is using ScrnPrnt.VCX. By using
this i am able to print the form as it is - including the border, combo/text outline etc.

What i want is my own border & content printing.

ShellExecute() gives only image printing. I am trying to use it with a prg with requireed positioning.

More of your sugession wellcome.

PS : Any good books available for VPF - apart from ?

Thanks

Sridhar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top