In VB, there is a PrintForm method. How do I send a form to the printer in FF3?
No idea how to do this.
Anyone else here know if this can be done? Could be a VB only thing.
Never really thought of it, but the first thought that comes to me is to determine the area of the form in question, grab a screenshot â€" and then printing the resulting bitmap ...
In the following routine I capture the active window to a file. Later I print that file. Is this what you were looking to do?
Sub CaptureBitmap(Pict$, Tm As Long)
Local hImage As Dword
Pict$ = DataPath$ + "BP_Image" + Trim$(Str$(Tm)) + ".bmp"
If Isfile(Pict$) Then 'Delete existing file
Kill Pict$
Do While Isfile(Pict$)
Sleep 100
Loop 'Make sure it is deleted before continuing
End If
SetCursorPos 0, 0 'Move cursor out of the way
Clipboard Reset 'clear the clipboard
Keybd_event(%VK_SnapShot, 1, 0, 0) 'active dialog to clipboard
Do
FF_DoEvents
Clipboard Get Bitmap hImage, LL 'get handle to bitmap
Loop Until LL
Graphic Attach hImage, 0 'attach to handle
Graphic Save Pict$ 'save the captured image
Do
Sleep 100
Loop Until Isfile(Pict$) 'Wait till the save is completed
Graphic Bitmap End
End Sub
I guess this is as close as we'll get to PrintForm. Thanks for your help. I will try it. It is interesting that PrintForm was in VB 6 but Microsoft left it out of VB.NET. However, there were so many complaints that they released a PrintForm add-on for .NET, and there are several others who sell their own implementations. They all work only for .NET and cannot be used with PB or FF.
I hope that a future version of FF will have this capability built in.
Thank you for this sample code its just what I needed. I had ask the same question on the Pb forums ,How to print a dialog / form, and the PB people even thought the solution was pretty cool. The sample there was buy Gary Beene but its about identical
Thanks
Doug