Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with PrintDesktop() using DibApi32.DLL
Message
 
To
08/02/2000 14:47:42
Dennis Schuette
Customized Business Services, Llc
Yuma, Arizona, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00327060
Message ID:
00329144
Views:
21
Denis,
One other person had this problem when pulling the method out of the class and running it as a seperate procedure. The problem is caused by the fact I mistakenly named the PrintWindow routine with the same name as the PrintWindow API call. Fox gets confused as to which one it is calling. This is the reason for the 'Too Few Arguments' error. The solution is to change the name of one of the PrintWindow's. The lastest version of my ScrnPrnt class File#94706 has this fix incorporated. If I remember correctly I used an alias in declaring the PrintWindow API call as the solution.

The CLEAR DLLS is fixing the problem by removing the ambiguous PrintWindow. It could affect other parts of your code by clearing DLL's unexpectedly.


>The fix was to add
>
>clear dlls
>
>just before the 'return' at the bottom of the PrintWindow procedure. I can now call this procedure as often as I need.
>
>Will this affect anything else I am doing?
>
>Denis Schuette
>McElhaney Cattle Co.
>
>>*!* *************************************************************
>>*!* PrintDesktop - Prints the entire VFP Desktop
>>*!* Provided by Steven Ruhl, via www.levelextreme.com
>>*!* *************************************************************
>>PROCEDURE PrintDesktop
>> PrintWindow(MainhWnd(), "PRINT VFP Desktop")
>> RETURN
>>
>>
>>*!* *************************************************************
>>*!* PrintWindow - Print a window
>>**!
>>*!* Paremeters:
>>*!* tnHWnd Window handle
>>*!* tcJobName Print Job Name
>>*!*
>>*!* Provided by Steven Ruhl, via www.levelextreme.com
>>*!* *************************************************************
>>PROCEDURE PrintWindow
>> LPARAMETERS tnHWnd, tcJobName
>>
>> LOCAL lcJobName && Print job name
>> LOCAL lnRetVal && Return value from API functions
>>
>> DECLARE INTEGER PrintWindow IN DibApi32 ;
>> INTEGER HWnd, ;
>> INTEGER fPrintArea, ;
>> INTEGER fPrintOpt, ;
>> INTEGER wxScale, ;
>> INTEGER wyScale, ;
>> STRING @ szJobName
>>
>> *!* Print entire window or just client area
>> #DEFINE PW_WINDOW 1
>> #DEFINE PW_CLIENT 2
>>
>> *!* How to size the printed image
>> *!* PW_BESTFIT resizes to fill paper while retaining proportions
>> *!* PW_STRETCHTOPAGE resizes to completely fill paper, distorts proportions
>> *!* PR_SCALE scale print size
>> #DEFINE PW_BESTFIT 1
>> #DEFINE PW_STRETCHTOPAGE 2
>> #DEFINE PW_SCALE 3
>>
>> *!* If you are not including FoxPro.H uncomment these lines
>>*!* #DEFINE MB_ICONEXCLAMATION 48
>>*!* #DEFINE MB_OK 0
>>
>> lcJobName = tcJobName + CHR(0)
>> lnRetVal = PrintWindow( tnHWnd, PW_WINDOW, PW_STRETCHTOPAGE, 0, 0, @lcJobName)
>> IF lnRetVal != 0
>> IF lnRetVal != 6 && 6 = User canceled printing
>> = MESSAGEBOX("Unable to print the window" + CRLF + ;
>> "PrintWindow API call returned " + STR(lnRetVal), ;
>> MB_ICONEXCLAMATION + MB_OK, ;
>> "ERROR printing window, see Common.prg, PrintWindow()")
>> ENDIF
>> ENDIF
>> RETURN
>>
>>
>>***************************************
>>
>>The above code works correctly the first time I run =PrintDeskTop(), however the SECOND time I try to run it, I get a 'Too few arguments' error. I have to get completely out of VFP, then it works for one try again. I am using VFP 5.0a, NT 4.0 Workstation, SP4.
>>
>>Thanks in advance,
>>Denis Schuette
>>McElhaney Cattle Co.
Steve Ruhl
CitiMortgage, Inc.
steven.ruhl@citibank.com Office
Steve@steven-ruhl.com Home
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform