Since I can't find the dll I can't say for sure it works in VFP 5-6. I'm sure it does, though. I'm not sure it would work in 2.6.
ray
>>Thanks for the Method. I can't find that dll anywhere. Where did you find it?
>>
>>Thanks,
>>
>>ray
>>>>I'm trying to add print screen capabilities to a VFP app. I understand that you can copy the contents of a screen to the clipboard with Alt-PrintScrn and that you can paste those contents into a general field in a database. I haven't been able to create a report that prints general fields, though. Is it possible?
>>>>
>>>>Or, is there some command or API call that will dump the contents of the clipboard straight to the printer?
>>>>
>>>>This app is targeted towards folks who are not necessariliy computer-literate, so I want to make this as simple as possible.
>>>>
>>>> TIA,
>Can this code work on FP 2.6
>
>mark oliva
>
>
>
>>>The best solution I have found is to use the DibApi32 DLL that is part of the WinCap sample on the MSDN CD (also available from the MS web site, search for WinCap). It contains a PrintWindow function that does a screen print.
>>>
>>>This is the PrintWindow method from my application class
>>>
>>>
>>>LPARAMETERS tnHWnd, tcJobName
>>>LOCAL lcJobName
>>>LOCAL lnRetVal
>>>
>>>DECLARE INTEGER PrintWindow IN DibApi32 ;
>>> INTEGER HWnd, ;
>>> INTEGER fPrintArea, ;
>>> INTEGER fPrintOpt, ;
>>> INTEGER wxScale, ;
>>> INTEGER wyScale, ;
>>> STRING @ szJobName
>>>
>>>#DEFINE PW_WINDOW 1
>>>#DEFINE PW_CLIENT 2
>>>#DEFINE PW_BESTFIT 1
>>>#DEFINE PW_STRETCHTOPAGE 2
>>>#DEFINE PW_SCALE 3
>>>
>>>lcJobName = tcJobName + CHR(0)
>>>lnRetVal = PrintWindow( tnHWnd, PW_WINDOW, PW_STRETCHTOPAGE, 0, 0, @lcJobName)
>>>IF lnRetVal != 0
>>> IF lnRetVal != 6
>>> = MESSAGEBOX("Unable to print the window" + CRLF + ;
>>> "PrintWindow API call returned " + STR(lnRetVal), ;
>>> MB_ICONEXCLAMATION + MB_OK, ;
>>> oApp.cApplicationName)
>>> ENDIF
>>>ENDIF
>>>RETURN
>>>
>>>
Some days it's not worth chewing through the leather straps ...