Autor Beitrag
anno2007
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win 7, Ubuntu
Delphi XE
BeitragVerfasst: Fr 23.11.07 22:06 
Hi,
ich hab versucht ein ganz simples windows.beep Programm zu scheiben, bei dem man in 2 Edit-Feldern die Tonhöhe und Tonlänge eingeben kann.
Also variable
ausblenden Delphi-Quelltext
1:
2:
a := edit1.text
              b := edit2.text


Wenn ich die Variablen jetzt in windows.beep einbringe bringt der Compiler eine Fehlermeldung.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button2Click(Sender: TObject);
var a, b : string;
begin
a := edit1.text;
b := edit2.text;

windows.beep(a, b);


Kann mir da jemand Helfen?

thx,
anno2007

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
TProgger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 148

XP
D6, D2007 prof
BeitragVerfasst: Fr 23.11.07 22:46 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Button2Click(Sender: TObject);
var a, b : Integer;
begin
a := StrToIntDef(edit1.text,0);
b := StrToIntDef(edit2.text,0);
windows.beep(a, b);

_________________
Wir haben für jede Lösung das richtige Problem ;)
anno2007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win 7, Ubuntu
Delphi XE
BeitragVerfasst: Fr 23.11.07 23:18 
Ok, danke, jetzt wollt ich noch was machen, und zwar

soll 'a' jetzt eine variable für irgendein Edit-Feld sein.

shellexecute(handle,'open','www. a .com',nil,nil,sw_show)

Wie muss ich a jetzt schreiben, das er a als variable anerkennt?

thx
anno2007
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 23.11.07 23:27 

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
TProgger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 148

XP
D6, D2007 prof
BeitragVerfasst: Fr 23.11.07 23:33 
user profile iconanno2007 hat folgendes geschrieben:


soll 'a' jetzt eine variable für irgendein Edit-Feld sein.

shellexecute(handle,'open','www. a .com',nil,nil,sw_show)

Wie muss ich a jetzt schreiben, das er a als variable anerkennt?

thx
anno2007

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var a: String;
 //..

a:='google';
shellexecute(handle,'open',PChar('http://www.'+a+'.com',nil,nil,sw_show);

So müsste es funktionieren, wenn du das meinst ;)

_________________
Wir haben für jede Lösung das richtige Problem ;)
anno2007 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 68

Win 7, Ubuntu
Delphi XE
BeitragVerfasst: Fr 23.11.07 23:54 
So ungefähr hab ich das gemeint, ich wollte halt nur, dass wenn ich in mein Edit-Feld
Google eingebe, dass er dann auf www.google.de geht.
Das funktioniert irgendwie mit einer Variablen nicht.
Ich habs jetzt aber rausgekriegt:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Button1Click(Sender: TObject);
var a, b :string ;
begin
a := edit1.text;
b := a;
shellexecute(handle,'open',PChar('http://www.'+b+'.de'),nil,nil,sw_show);


So gehts :D

Also, nochma Danke, für alle die mir geholfen haben!

anno2007

Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt