Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Difference between vfox6 & 8
Message
De
23/11/2012 06:11:42
 
 
À
23/11/2012 05:42:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01557845
Message ID:
01557848
Vues:
65
Indeed Gregory. Solved !

Hartelijk bedankt

>Just tested on
>
>(1) Win7X64 + vfp9
>(2) WinXp + vfp6
>
>Both work
>
>But the problem may be that os(3) returns
>- vfp6 : Windows 5.01
>- vfp9 : 6
>
>For plain OS()
>- vfp6 : Windows 5.01
>- vfp9 : Windows 6.01
>
>So, val(os(3)) returns 0 in vfp6 and a number > 0 in vfp9
>
>Something compatible is
>
>#define VERSION_OF_WINDOWS	(eval(ltrim(substr(os(), at(' ', os())))))
>
>
>What's happening is that in vfp6 you use CreateFile with WIN98_DELETE + WIN98_WRITE while in vfp9 you use GENERIC_READ
>
>Think always using GENERIC_READ (since the function is called checkreadrights) may solve the problem
>
>__
>>The following function works in vfox 8 and not in 6.
>>Any reason why ?
>>
>>
>>FUNCTION checkreadrights
>>LPARAMETERS cFile
>>DECLARE Integer CreateFile IN WIN32API ;
>>   String lpFilename, ;
>>   Integer dwDesiredAccess, ;
>>   Integer dwShareMode, ;
>>   Integer lpSecurityAttributes_optional, ;
>>   Integer dwCreateDisposition, ;
>>   Integer dwFlagsAndAttributes, ;
>>   Integer hTemplateFile_option
>>
>>DECLARE INTEGER CloseHandle IN WIN32API ;
>>   Integer hHandle
>>
>>DECLARE INTEGER GetLastError IN kernel32.DLL
>>
>>DECLARE INTEGER FormatMessage IN kernel32.dll INTEGER, STRING, INTEGER, INTEGER, STRING@, INTEGER, STRING
>>
>>#DEFINE WIN98_DELETE      0x00010000
>>#DEFINE WIN98_WRITE       0x40000000
>>
>>#DEFINE FILE_SHARE_DELETE 0X00000004
>>#DEFINE FILE_SHARE_READ   0X00000001
>>#DEFINE FILE_SHARE_WRITE  0X00000002
>>#DEFINE FILE_FLAG_BACKUP_SEMANTICS 0x02000000
>>
>>#DEFINE CREATE_NEW        0X00000001
>>#DEFINE CREATE_ALWAYS     0X00000002
>>#DEFINE OPEN_EXISTING     0X00000003
>>#DEFINE OPEN_ALWAYS       0X00000004
>>#DEFINE TRUNCATE_EXISTING 0X00000005
>>
>>#DEFINE GENERIC_READ      0x80000000
>>
>>LOCAL nHandle, cReturn, lFile[1], nSize
>>
>>nHandle = CreateFile(cFile, IIF(VAL(OS(3)) < 5, WIN98_DELETE + WIN98_WRITE, GENERIC_READ),  ;
>>   0, ;
>>   0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)
>>
>>IF nHandle <> -1 
>>   LReturn = .T.
>>   CloseHandle(nHandle)
>>ELSE
>>	LReturn = .F.
>>ENDIF 	
>>RETURN LReturn 
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform