Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can VFP determine MS Project version on a file
Message
De
11/02/2002 17:49:58
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00618395
Message ID:
00618615
Vues:
14
This message has been marked as a message which has helped to the initial question of the thread.
>>The brute force approach could be to open the MPP file using the LLFF and read the first 5000 bytes of the file. The string "Microsoft Project 9.0" will be there for Project 2000. "Microsoft Project 8.0" will be there for Project 98.
>>
>>HTH.
>
>This code seemed to work OK:
>
>lcheck = FILETOSTR('C:\Temp\Project2.mpp')
>llcontinue = .F.
>FOR i = 1 TO 6000
>  IF UPPER(SUBSTR(lcheck,i,17)) = 'MICROSOFT PROJECT'
>    lcFound = SUBSTR(lcheck,i,21)
>    EXIT
>  ENDIF
>ENDFOR
>
>IF NOT EMPTY(lcFound)
>  RETURN(lcFound)
>ELSE
>  RETURN('Unknown')
>ENDIF
>
The probable reason Larry was asking about performance is the size of the project, and the For/Next loop. The size can be neglected, if you use just the first 6000 bytes, and the speed will improve if you use no loop:
nGFH = fopen('C:\Temp\Project2.mpp')
lcCheck=fread(nGFH, 6000)
fclose(nGFH)
lFound = .F.
#define C_MSP 'MICROSOFT PROJECT'
FOR i = 1 TO occurs(c_msp, lcCheck)
  nFoundAt=atc(c_msp, lcCheck) 
  if "8.0" $ substr(lcCheck,i,21)
    lFound=.t.
    EXIT
  ENDIF
ENDFOR
return lFound
ENDIF
This should be faster.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform