Kommunerne har digitaliseret indgangen for borgerne. Men bag skærmen håndteres mange arbejdsgange stadig manuelt mellem systemer, mails og organisatoriske siloer.
destructor TDiskScanner.Destroy; begin FFiles.Free; inherited; end;
procedure TDiskScanner.ScanFiles( const aPath : String; Subs : Boolean; const L : TStrings ); VAR S : TSearchRec; CPath : String; begin ChDir(aPath); GetDir(0,CPath); if FindFirst(IncludeTrailingPathDelimiter(CPath)+FMask,faANYFILE,S) = 0 then repeat if ( S.Attr and faSysFile = 0 ) and ( S.Attr and faDIRECTORY = 0 ) and ( S.Attr and faVolumeID = 0 ) and ( S.Name <> '.' ) and ( S.Name <> '..' ) then begin if Assigned(FOnAddToList) then begin if FOnAddToList(Self,IncludeTrailingPathDelimiter(CPath)+S.FindData.cFileName,S) then L.AddObject(IncludeTrailingPathDelimiter(CPath)+S.FindData.cFileName,TObject(FLevel)); end else L.AddObject(IncludeTrailingPathDelimiter(CPath)+S.FindData.cFileName,TObject(FLevel)); end; until FindNext(S) <> 0; FindClose(S);
if Subs and ( FindFirst(FMask,faDIRECTORY,S) = 0 ) then repeat if ( S.Attr and faDIRECTORY <> 0 ) and ( S.Name <> '.' ) and ( S.Name <> '..' ) then begin Inc(FLevel); ScanFiles(IncludeTrailingPathDelimiter(CPath)+S.Name,Subs,L); Dec(FLevel); ChDir('..'); end; until FindNext(S) <> 0; FindClose(S); end;
procedure TDiskScanner.ScanDir( const aPath : String; Subs : Boolean; const L : TStrings ); VAR S : TSearchRec; CPath : String; begin ChDir(aPath); GetDir(0,CPath); if Subs and ( FindFirst(FMask,faDIRECTORY,S) = 0 ) then repeat try if ( S.Attr and faDIRECTORY <> 0 ) and ( S.Name <> '.' ) and ( S.Name <> '..' ) then begin if Assigned(FOnAddToList) then begin if FOnAddToList(Self,IncludeTrailingPathDelimiter(CPath)+S.FindData.cFileName,S) then L.AddObject(IncludeTrailingPathDelimiter(CPath)+S.FindData.cFileName,TObject(FLevel)); end else L.AddObject(IncludeTrailingPathDelimiter(CPath)+S.FindData.cFileName,TObject(FLevel)); Inc(FLevel); ScanDir(IncludeTrailingPathDelimiter(CPath)+S.FindData.cFileName,Subs,L); Dec(FLevel); ChDir('..'); end; except on E:Exception do FLastScanError := E.Message; end; until FindNext(S) <> 0; FindClose(S); end;
function TDiskScanner.Execute: Boolean; begin Result := TRUE; FFiles.Clear; FLevel := 0; case FScanMode of //dsmFiles : ScanFiles(IncludeTrailingBackslash(FPath),FScanSubDirs,FFiles); dsmFiles : ScanFiles(FPath,FScanSubDirs,FFiles); //dsmDirectory : ScanDir(IncludeTrailingBackslash(FPath),FScanSubDirs,FFiles); dsmDirectory : ScanDir(FPath,FScanSubDirs,FFiles); end; end;
procedure TDiskScanner.SetFiles(const Value: TStrings); begin FFiles.Assign(Value); end;
procedure TDiskScanner.SetOnAddToList( const Value: TDiskScannerAddToFileEvent); begin FOnAddToList := Value; end;
procedure TDiskScanner.SetPath(const Value: String); begin FPath := ExtractFilePath(Value); end;
procedure TDiskScanner.SetScanMode(const Value: TScannerMode); begin FScanMode := Value; end;
procedure TDiskScanner.SetScanSubDirs(const Value: Boolean); begin FScanSubDirs := Value; end;
procedure TDiskScanner.SetMask(const Value: String); begin FMask := Value; end;
The CopyFile function copies an existing file to a new file.
BOOL CopyFile(
LPCTSTR lpExistingFileName, // pointer to name of an existing file LPCTSTR lpNewFileName, // pointer to filename to copy to BOOL bFailIfExists // flag for operation if file exists );
Nej der er du lidt galt på den, VCL'en er GUI orienteret mange andre units er ikke sysutils f.eks., men Windows er et styresystem dvs. det er også windows når det er en console app. du kører og en console app er en 32bit windows console app. den kører ikke med en rigtig DOS 6.22.
Så bør du ikke bruge udtrykken en Console Application !
Jeg kan sikkert godt skrive dig sådan en dims til dig der kan det hele. Men så bliver det i Turbo pascal.
Jens B
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.