Ich versuche als Hobbyprogrammierer mein VO2.8 auf X# umzustellen.
Mit Pointern habe ich keine Ahnung und habe da immer nur ferige Routinen eingesetzt.
Wie kann ich das Problem lösen?
error XS9061: The "PTR(..) operation" is not allowed for method or function calls. If the method or function returns a pointer then consider using the (<Type> PTR) syntax instead.
in Zeile: pszDrives := PTR( BYTE, MemAlloc( dw ) )
Code: Select all
FUNCTION FabGetLogicalDrivesArray( lDriveOnly ) AS ARRAY
//g Files,Files Related Classes/Functions
//g Drives,Drives related Classes/Functions
//d Retrieve all existing drives, and return an array with/without drives type \line
//d If lDriveOnly is True :\line
//d { { "A" }, { "C" }, { "D" }, { "K" } }\line
//d If lDriveOnly is False\line
//d { { "A", DRIVE_REMOVABLE }, { "C", DRIVE_FIXED }, { "K", DRIVE_REMOTE } }\line
LOCAL dw AS DWORD
LOCAL pszDrives AS BYTE PTR
LOCAL aRet AS ARRAY
LOCAL aTemp AS ARRAY
LOCAL wCpt AS WORD
LOCAL bByte AS BYTE
LOCAL cDrv AS STRING
//
Default( @lDriveOnly, FALSE )
//
dw := GetLogicalDriveStrings( 0, null_ptr )
pszDrives := PTR( BYTE, MemAlloc( dw ) )
//
GetLogicalDriveStrings( dw, pszDrives )
//
aRet := {}
cDrv := ""
FOR wCpt := 1 TO dw
//
bByte := pszDrives[ wCpt ]
IF ( bByte != 0 )
cDrv := cDrv + Chr( bByte )
ELSE
IF ( cDrv == "" )
// We should point on the last caracters, the FOR loop will end
ELSE
IF lDriveOnly
aTemp := { Upper( cDrv ) }
ELSE
aTemp := { Upper( cDrv ), GetDriveType( String2Psz( cDrv ) ) }
ENDIF
//
AAdd( aRet, aTemp )
cDrv := ""
ENDIF
ENDIF
NEXT
//
MemFree( pszDrives )
//
RETURN aRet
