Autor Beitrag
Mindforce
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: So 30.07.06 13:39 
Hi,

jetzt denkt ihr ich wär mega blöd... :P :lol:
Aber ich verstehe das einfach nicht, wie man functions deklariert.

Kann mir jemand sagen wo und wie ich diese function deklarieren muss??? Ich wäre euch sehr dankbar!!!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
function RenameFileEx(const AOldName, ANewName: string;
   ARenameCheck: boolean = false): boolean;
var
  sh: TSHFileOpStruct;
begin
  sh.Wnd := Application.Handle;
  sh.wFunc := fo_Move;

  // String muss mit #0#0 Terminiert werden, um das Listenende zu setzen
  sh.pFrom := PChar(AOldName + #0);
  sh.pTo := PChar(ANewName + #0);
  sh.fFlags := fof_Silent or fof_MultiDestFiles;
  if ARenameCheck then
    sh.fFlags := sh.fFlags or fof_RenameOnCollision;
  Result:=ShFileOperation(sh)=0;
end;


Danke.

Gruss,

M!ndbyte

/Edit: Siehe auch hier: www.dsdt.info/tipps/...mp;search=umbenennen

_________________
Our force; in mind.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 30.07.06 13:47 
Ich verstehe deine Frage nicht.

_________________
Markus Kinzler.
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: So 30.07.06 13:48 
Hi,

ausblenden Delphi-Quelltext
1:
2:
3:
4:
type
private
public oder
implementation


Kann ich auch nicht besser erklären... :lol:

Gruss,

M!ndbyte

_________________
Our force; in mind.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 30.07.06 13:50 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
private
function RenameFileEx(const AOldName, ANewName: string;
   ARenameCheck: boolean = false): boolean;

implementation

function TForm1.RenameFileEx(const AOldName, ANewName: string;
   ARenameCheck: boolean = false): boolean;
var
  sh: TSHFileOpStruct;
begin
  sh.Wnd := Application.Handle;
  sh.wFunc := fo_Move;

  // String muss mit #0#0 Terminiert werden, um das Listenende zu setzen
  sh.pFrom := PChar(AOldName + #0);
  sh.pTo := PChar(ANewName + #0);
  sh.fFlags := fof_Silent or fof_MultiDestFiles;
  if ARenameCheck then
    sh.fFlags := sh.fFlags or fof_RenameOnCollision;
  Result:=ShFileOperation(sh)=0;
end;
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: So 30.07.06 13:51 
Hi,

[Hinweis] Unit1.pas(110): H2219 Das private-Symbol 'RenameFileEx' wurde deklariert, aber nie verwendet //Hmmm.... Doch!!!
[Fehler] Unit1.pas(110): E2065 Ungenügende Forward- oder External-Deklaration: 'TForm1.RenameFileEx' // KA

Gruss,

M!ndbyte

_________________
Our force; in mind.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 30.07.06 13:52 
Man könnte es auch als freie Prozedur implementieren.

_________________
Markus Kinzler.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 30.07.06 13:54 
user profile iconMindforce hat folgendes geschrieben:

[Hinweis] Unit1.pas(110): H2219 Das private-Symbol 'RenameFileEx' wurde deklariert, aber nie verwendet //Hmmm.... Doch!!!
[Fehler] Unit1.pas(110): E2065 Ungenügende Forward- oder External-Deklaration: 'TForm1.RenameFileEx' // KA

Poste mal die ganze Unit.

user profile iconmkinzler hat folgendes geschrieben:
Man könnte es auch als freie Prozedur implementieren.

Je nachdem, wie er es möchte.
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: So 30.07.06 14:00 
OMG... Das ist ne Private Unit. Aber ich send sie mal als Teil Unit...

Gruss,

M!ndbyte

_________________
Our force; in mind.
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: So 30.07.06 14:07 
Hi,

ich hab sie mal eben zusammengewürfelt.

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, ComCtrls, JPEG, Mp3FileUtils, EnhEdit, FileBtn,
  RackCtls, ShellApi;

type
  TForm1 = class(TForm)
    PageControl1: TPageControl;

  procedure FormCreate(Sender: TObject);

  private
    function RenameFileEx(const AOldName, ANewName: string;  // Hier solllll der Fehler sitzen.
   ARenameCheck: boolean = false): boolean;
  public

    end;

var
  Form1: TForm1;
  Id3v1Tag: TId3v1Tag;
  Id3v2Tag: TId3v2Tag;
  mpegInfo: TMpegInfo;

  CommentDescriptions: TFrameDescriptionArray;
  LyricsDescriptions: TFrameDescriptionArray;
  PictureDescriptions: TPictureFrameDescriptionArray;

implementation

uses UNewPicture, UNewLyrics;

{$R *.dfm}

function RenameFileEx(const AOldName, ANewName: string;
   ARenameCheck: boolean = false): boolean;
var
  sh: TSHFileOpStruct;
begin
  sh.Wnd := Application.Handle;
  sh.wFunc := fo_Move;

  // String muss mit #0#0 Terminiert werden, um das Listenende zu setzen
  sh.pFrom := PChar(AOldName + #0);
  sh.pTo := PChar(ANewName + #0);
  sh.fFlags := fof_Silent or fof_MultiDestFiles;
  if ARenameCheck then
    sh.fFlags := sh.fFlags or fof_RenameOnCollision;
  Result:=ShFileOperation(sh)=0;
end;
end.


Ich hoffe dieses kleine Stück reicht...

Gruss,

M!ndbyte

_________________
Our force; in mind.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 30.07.06 14:09 
In diesem Fall muß es in Zeile 39
ausblenden Delphi-Quelltext
1:
function TForm1.RenameFileEx(const AOldName, ANewName: string;					

heißen

_________________
Markus Kinzler.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 30.07.06 14:10 
user profile iconmkinzler hat folgendes geschrieben:
In diesem Fall muß es in Zeile 39
ausblenden Delphi-Quelltext
1:
function TForm1.RenameFileEx(const AOldName, ANewName: string;					

heißen

Steht doch oben bei mir so :roll:
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: So 30.07.06 14:13 
Hi,

vielleicht habt ihr den Link übersehen. Der ist vielleicht ganz hilfreich denk ich mal... :?

www.dsdt.info/tipps/...mp;search=umbenennen

Gruss,

M!ndbyte

_________________
Our force; in mind.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 30.07.06 14:14 
Zitat:
Steht doch oben bei mir so :roll:
In seinem Code aber nicht !
Zitat:
vielleicht habt ihr den Link übersehen. Der ist vielleicht ganz hilfreich denk ich mal...
Warum sollte er für uns hilfreich sein?

_________________
Markus Kinzler.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 30.07.06 14:17 
user profile iconmkinzler hat folgendes geschrieben:
Zitat:
Steht doch oben bei mir so :roll:
In seinem Code aber nicht !

Anscheinend hat er sich das nicht angeschaut.
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: So 30.07.06 14:17 
Hi,

weil der daher kommt. Und weil ihr das mit den procedures und den functions alle könnt... :lol:

Gruss,

M!ndbyte

_________________
Our force; in mind.
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: So 30.07.06 14:39 
HI,

habt ihr diese function noch NIE genutzt???
Bitte helft mir. WÄRE ECHTT NETT.

Gruss,

M!ndbyte

_________________
Our force; in mind.


Zuletzt bearbeitet von Mindforce am So 30.07.06 14:49, insgesamt 1-mal bearbeitet
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 30.07.06 14:41 
user profile iconMindforce hat folgendes geschrieben:
HI,

habt ihr diese function noch NIE genutzt???
Bitte helft mir. WÄRE ECHTT NETT.

Gruss,

M!ndbyte

Wobei denn helfen? Das Problem ist doch gelöst...
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 30.07.06 14:44 
Was ist jetzt noch das Problem, wenn du die vorgeschlagene kleine korrektur am Code durchführst, ist die Funktion eigentlich einsatzbereit und kann aufgerufen werden.

_________________
Markus Kinzler.
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: So 30.07.06 15:11 
Hi,

danke funktioniert...
Könnt ihr mir noch einmal helfen undzwar:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
if d.Checked then begin
 RenameFileEx(edit1.text + #0 + lblv2titel.Text +'.mp3');

Edit1.Text // Dort ist der komplette Pfad der Datei angegeben
lblv2titel.Text // Dort steht wie die Datei benennt werden soll.


Und wiesio sagt er dann dies:???

[Fehler] Unit1.pas(496): E2035 Nicht genügend wirkliche Parameter

Vielen Dank nochma für eure hilfe. :lol:

Gruss,

M!ndbyte

_________________
Our force; in mind.
Mindforce Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: So 30.07.06 15:15 
Hi,

ok hat sich schon erledigt... Man muss irgendwie 2 Sachen umbenennen. Warum auch immer.

Gruss,

M!ndbyte

_________________
Our force; in mind.