Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HDC Using VBPrinter.OCX
Message
 
 
Information générale
Forum:
Windows
Catégorie:
API
Divers
Thread ID:
00940522
Message ID:
00941346
Vues:
13
>>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.

BTW, the TYPE() function will always return type "U" for expression that includes UDF's, for example
? TestType(), TYPE("TestType()")         && Displays: Test U

FUNCTION TestType
RETURN "Test"
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform