Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HDC Using VBPrinter.OCX
Message
 
 
To
09/09/2004 05:01:50
General information
Forum:
Windows
Category:
API
Miscellaneous
Thread ID:
00940522
Message ID:
00941342
Views:
17
>My VFP 6/8 app uses VBPrinter to get a Device Context Handle (hDC) to a printer or PDF Driver, allowing users to select a driver and modify preferences before sending a non VFP Graphics output to the hDC for printing. This has worked well for years, but suddenly I find in WinXP and Win2000 that a negative integer is sometimes being returned, caused by too large a number being wrapped around to a negative by the code below. For example the value returned by the HexToBin function below is 2652965944 (Type "U" in VFP), and is being transformed in the BITOR function to
>-1642001352. This is obviously an invalid hDC. Can anyone suggest a work around?

Hi Mike,

The HDC is 4 bytes unsigned integer which VFP doesn't support. Both, 2652965944 and -1642001352, are two different representations of the same number in VFP. Which one to use depends where you're using them. The problem isn't in your code that returns HDC. You can get negative HDC if you use Common Dialog Control Activex, for example
oDlg = CREATEOBJECT("MsComDlg.CommonDialog")
oDlg.Flags = 0x00000100
? NVL(oDlg.ShowPrinter(),""), oDlg.hDC, TRANSFORM(oDlg.hDC, "@0")
The problem is in passing that HDC to the non-vfp controls which expect unsigned integer.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform