Autor Beitrag
dorian_89
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43

Win XP
Delphi 2005; Html
BeitragVerfasst: Sa 21.01.06 20:23 
Ich bin in Delphi 2005 leider ein absoluter N00b und kann sonst, ausser html mit ein bisschen java und php, auch keine anderen Programmiersprachen. Jetzt lerne ich in der Schule seit einem guten halben Jahr Delphi 2005 und bin ziemlich begeistert.

Allerdings hätte ich da eine Frage: ist es möglich, in Delphi einen Link zum schreiben einer E-Mail zu machen, also einen der das Standard e_Mail Programm des Rechners öffnet(ähnlich wie in html)?

Schon mal vielen Dank für eure Antworten.
Dorian

_________________
Der Punker am Rechner


Zuletzt bearbeitet von dorian_89 am Sa 21.01.06 21:32, insgesamt 1-mal bearbeitet
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 21.01.06 20:28 
Schau mal nach ShellExecute.
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Sa 21.01.06 21:30 
Hallo,

bitte ändere den Titel des Topics, da er wenig über das eigentlich Thema verrät.
Hier der entsprechende Absatz aus den Richtlinien:

1.2 Beiträge:
Bitte formuliere den Betreff Deiner Beiträge so, dass andere Mitglieder anhand dieser bereits das eigentliche Thema festmachen können. Beiträge wie etwa "Eine Anfängerfrage" oder "Weiß jemand, wie das geht?" lassen den Leser im Unklaren darüber, was das Thema der Diskussion ist.[...]


Einfach oben bei Deinem ersten Beitrag auf user defined image klicken und den Titel ändern. Dank Dir!

Viele Grüße,
Chryzler :wink:
dorian_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43

Win XP
Delphi 2005; Html
BeitragVerfasst: Sa 21.01.06 23:11 
Titel: Erst mal danke, aber...
user profile iconBlackheart666 hat folgendes geschrieben:
Schau mal nach ShellExecute.


Erst einmal vielen Dank. Ich habe den Befehl in der Delphi Hilfe auch gefunden, fang aber mit den Erläuterrungen rein garnichts an. Mein Problem ist folgendes: Ich habe einen Text in einer RichTextbox und möchte gerne einen Link zum Standard e-mail Programm des verwenders machen, und im somit die Möglichkeit geben mir den Text per e-mail zu schicken. Ist dies mit dem ShellExecute Befehl möglich, und wenn ja wie?

Dorian

_________________
Der Punker am Rechner
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: So 22.01.06 01:07 
Damit öffnet sich das standard Emailprogramm mit angegebener Adresse.
ausblenden Delphi-Quelltext
1:
ShellExecute(Handle, 'open', 'mailto:Cooro@hotmail.de', nil, nil, SW_SHOWNORMAL);					

Quelle

:wave:
dorian_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43

Win XP
Delphi 2005; Html
BeitragVerfasst: So 22.01.06 09:23 
Titel: Nochmals danke, aber schon wieder aber...
Ich habe den Quelltext (für den ich sehr dankbar bin) nun eingefügt, so dass der Befehl ausgeführt wird wenn man einen Button drückt. Delphi erkennt aber weder ShellExecute noch SW_SHOWNORMAL, also unterkringelt sie rot und meint: Undefenierter Bezeichner, was habe ich nun schon wieder falsch gemacht?

Dorian

_________________
Der Punker am Rechner
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: So 22.01.06 13:20 
sorry
ausblenden Delphi-Quelltext
1:
2:
uses
..., ShellAPI;


:wave:
dorian_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43

Win XP
Delphi 2005; Html
BeitragVerfasst: So 22.01.06 16:03 
Jetzt erkennt Delphi zwar ShellExecute, SW_SHOWNORMAL aber immer noch nicht. Habe ich etwas weiteres vergessen?
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: So 22.01.06 16:28 
In meinem Delphi 2005 funktioniert es.

Sonst hab ich noch
ausblenden Delphi-Quelltext
1:
2:
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ShellAPI;

in den Uses stehen.
dorian_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43

Win XP
Delphi 2005; Html
BeitragVerfasst: So 22.01.06 17:14 
Danke, ich habe die Uses in meine Kopiert, und nun erkennt er alles, bringt aber die Fehlermeldung:

"Es gibt keine überladene Version von 'ShellExecute', die man mit diese Argumenten aufrufen kann"

Was soll dass den nun schon wieder heissen???

_________________
Der Punker am Rechner
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: So 22.01.06 17:55 
Am besten ist du zeigst uns mal deinen Quellcode.
dorian_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43

Win XP
Delphi 2005; Html
BeitragVerfasst: So 22.01.06 18:55 
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:
23:
24:
25:
26:
unit WinForm1;

interface

uses
  System.Drawing, System.Collections, System.ComponentModel,
  System.Windows.Forms, System.Data, System.Resources, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ShellAPI;


type
  TWinForm1 = class(System.Windows.Forms.Form)
  
  [assembly: RuntimeRequiredAttribute(TypeOf(TWinForm1))]

implementation
 var kosten: Integer;
 var bestellung : string;
 var kostenmonat: integer;
 var server: string;
 var homepage: string;
 var bearbeiten: string;
 var bearbeiten2: string;
 var homepage2: string;
 var server2: string;

{$AUTOBOX ON}


dann folgt ja dieser code für die Konstruktion,
und das:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
procedure TWinForm1.Dispose(Disposing: Boolean);
begin
  if Disposing then
  begin
    if Components <> nil then
      Components.Dispose();
  end;
  inherited Dispose(Disposing);
end;

constructor TWinForm1.Create;
begin
  inherited Create;
  //
  // Erforderlich für die Unterstützung des Windows Forms-Designers
  //
  InitializeComponent;
  //
  // TODO: Fügen Sie nach dem Aufruf von InitializeComponent Konstruktorcode hinzu.
  //
end;


dann folgt das Programm wobei ja nur der Teil mit ShellExecute interresiert:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TWinForm1.Button2_Click(sender: System.Object; e: System.EventArgs);
begin

  ShellExecute(Handle, 'open', 'mailto:bestellung@kedo-productions.de', nil, nil, SW_SHOWNORMAL);

end;


Unpassende oder falsche o.ä. Bezeichnungen bitte ich zu entschuldigen, ich kenne die richtigen Ausdrücke nicht und wollte damit niemand verärgern.
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 22.01.06 19:02 
Hallo,

vergess mal bitte kurz alle anderen Postings und probier diesen Code :wink: :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
uses ShellApi;
...
ShellExecute(Application.Handle, 'open',
PChar('mailto:name@domain.de?subject=Betreff&body=irgendein Text'), nil, nil, sw_ShowNormal);


Das hab ich dem EasyHelper von www.delphi-source.de entnommen

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
dorian_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43

Win XP
Delphi 2005; Html
BeitragVerfasst: So 22.01.06 19:13 
Danke, Danke, Danke.
Nachdem ich den Quelltext kopiert hab ging es noch nicht gleich. Erst nachdem ich PChar rausgestrichen ha ging es. Hat das Auswirkungen? Auf jeden Fall hat er getan was ich wollte Viele Vielen Dank.

P.S. So siehts bei mir jetzt aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TWinForm1.Button2_Click(sender: System.Object; e: System.EventArgs);
begin

  ShellExecute(Application.Handle, 'open', ('mailto:bestellung@kedo-productions.de?subject=Bestellung&body=Bla'), nil, nil, sw_ShowNormal);

end;

_________________
Der Punker am Rechner
dorian_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43

Win XP
Delphi 2005; Html
BeitragVerfasst: So 22.01.06 19:22 
Und kann ich nun auch als den body einen Text aus einer Richtextbox einfügen?
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 22.01.06 19:26 
Sorry, aber was ist eine Richtextbox? Bei mir gibts es so eine Komponente nicht...

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
dorian_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43

Win XP
Delphi 2005; Html
BeitragVerfasst: So 22.01.06 19:29 
Eine Textbox, die ähnlich wie eine Textbox ist, allerdings auch größer als eine Zeile sein kann, also sie unterstützt Zeilenumbrüche, allerdings ist es mir egal ob ich den text aus einer Richtextbox einfüge, aus einer 'Standard' Textbox, oder was für einem Textfeld auch immer.

_________________
Der Punker am Rechner
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 22.01.06 19:41 
So?

ausblenden Delphi-Quelltext
1:
mailto:bestellung@kedo-productions.de?subject=Bestellung&body='+edit1.text					

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
dorian_89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43

Win XP
Delphi 2005; Html
BeitragVerfasst: So 22.01.06 19:53 
Ich weiß, ich stell mich ober doof an, aber entweder sitz ich heut gewaltig auf der Leitung, oder es ist wegen der Mathearbeit morgen... Naja, trotzdem: Wie muss ich da jetzt die ganzen anführungszeichen setzen (also diese: ' )??

ausblenden Delphi-Quelltext
1:
2:
3:
  ShellExecute(Application.Handle, 'open',
  ('mailto:bestellung@kedo-productions.de?subject=Bestellung&body='+Richtextbox2.text'),
  nil, nil, sw_ShowNormal);

Ich hab das jetzt so gemacht, aber da unterringelt er nur das letzte anführungszeichen, die Klammer, das Komma und das nil.
Was ist denn nun schon wieder falsch?

_________________
Der Punker am Rechner
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: So 22.01.06 20:08 
ausblenden Delphi-Quelltext
1:
2:
3:
  ShellExecute(Application.Handle, 'open',
  ('mailto:bestellung@kedo-productions.de?subject=Bestellung&body='+Richtextbox2.text),
  nil, nil, sw_ShowNormal);