| Autor |
Beitrag |
meskalin
Hält's aus hier
Beiträge: 5
|
Verfasst: So 22.07.07 20:17
ich wollte ein prog schreiben dass ein suchfrmular ausfüllt und abschickt,
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: 56: 57: 58: 59: 60:
| unit Unit1; interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, TWebTool;
type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private Webbrowser1: TWebBrowser Webdings1: TWebTool
public end;
var Form1: TForm1; Webbrowser1: TWebBrowser.create; Webdings1: TWebTool.create; implementation
{$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin Webbrowser1.Navigate('http://www.'); Caption := Webbrowser1.OleObject.Document.Title; end;
procedure TForm1.WebBrowserDocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); begin if Webdings1.FillForm(WebBrowser1, 'search', 'foo') = False then ShowMessage('Error. Field not available or no Form found.'); end;
procedure TForm1.WebBrowserProgressChange(Sender: TObject; Progress, ProgressMax: Integer); begin if ProgressMax = 0 then begin label1.Caption := ''; Exit; end; try if (Progress <> -1) and (Progress <= ProgressMax) then label1.Caption := IntToStr((Progress * 100) div ProgressMax) + '% loaded...' else label1.Caption := ''; except on EDivByZero do Exit; end; end;
end. |
Das war die gui ich hoffe es stimmt so, bisher hab ich hauptsächlich Java programmiert.
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:
| unit TWebTool;
interface uses OleCtrls; function FillForm(var WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean;
implementation
function FillForm(var WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean; var i, j: Integer; FormItem: Variant; begin Result := False; if WebBrowser.OleObject.Document.all.tags('FORM').Length = 0 then begin Exit; end; for I := 0 to WebBrowser.OleObject.Document.forms.Length - 1 do begin FormItem := WebBrowser.OleObject.Document.forms.Item(I); for j := 0 to FormItem.Length - 1 do begin try if FormItem.Item(j).Name = FieldName then begin FormItem.Item(j).Value := Value; Result := True; end; except Exit; end; end; end; end; end. |
bei dieser klasse kommen leider die fehelermeldungen:
[Pascal Error] TWebTool.pas(6): E2003 Undeclared identifier: 'TWebBrowser'
[Pascal Error] TWebTool.pas(1  : E2029 'THEN' expected but identifier 'OleObject' found
[Pascal Error] TWebTool.pas(23): E2029 'DO' expected but identifier 'OleObject' found
[Pascal Error] TWebTool.pas(25): E2066 Missing operator or semicolon
[Pascal Error] TWebTool.pas(25): E2066 Missing operator or semicolon
[Pascal Fatal Error] Unit1.pas(7): F2063 Could not compile used unit 'TWebTool.pas'
|
|
GTA-Place
      

Beiträge: 5248
Erhaltene Danke: 2
WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
|
Verfasst: Mo 23.07.07 06:53
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: 56: 57: 58: 59: 60:
| unit Unit1; interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, TWebTool;
type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private Webbrowser1: TWebBrowser; Webdings1: TWebTool; public end;
var Form1: TForm1; Webbrowser1: TWebBrowser.create; Webdings1: TWebTool.create; implementation
{$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin Webbrowser1.Navigate('http://www.'); Caption := Webbrowser1.OleObject.Document.Title; end;
procedure TForm1.WebBrowserDocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); begin if Webdings1.FillForm(WebBrowser1, 'search', 'foo') = False then ShowMessage('Error. Field not available or no Form found.'); end;
procedure TForm1.WebBrowserProgressChange(Sender: TObject; Progress, ProgressMax: Integer); begin if ProgressMax = 0 then begin label1.Caption := ''; Exit; end; try if (Progress <> -1) and (Progress <= ProgressMax) then label1.Caption := IntToStr((Progress * 100) div ProgressMax) + '% loaded...' else label1.Caption := ''; except on EDivByZero do Exit; end; end;
end. |
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:
| unit TWebTool;
interface uses OleCtrls, SHDocVw_TLB; function FillForm(var WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean;
implementation
function FillForm(var WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean; var i, j: Integer; FormItem: Variant; begin Result := False; if WebBrowser.OleObject.Document.all.tags('FORM').Length = 0 then begin Exit; end; for I := 0 to WebBrowser.OleObject.Document.forms.Length - 1 do begin FormItem := WebBrowser.OleObject.Document.forms.Item(I); for j := 0 to FormItem.Length - 1 do begin try if FormItem.Item(j).Name = FieldName then begin FormItem.Item(j).Value := Value; Result := True; end; except Exit; end; end; end; end; end. |
Mehr Fehler habe ich im Moment nicht gefunden.
_________________ "Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
|
|
meskalin 
Hält's aus hier
Beiträge: 5
|
Verfasst: So 29.07.07 11:54
thx, aber leider funtzt es noch nicht:
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: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, WebTool, SHDocVw;
type TForm1 = class(TForm) Button1: TButton;
procedure Button1Click(Sender: TObject); private Webbrowser1: TWebBrowser; Webdings1: TWebTool; procedure WebBrowserDocumentComplete(Sender: TObject;const pDisp: IDispatch; var URL: OleVariant); procedure WebBrowserProgressChange(Sender: TObject; Progress, ProgressMax: Integer);
public constructor Create; destructor Destroy; override; end;
var Form1: TForm1;
implementation
{$R *.dfm} constructor TForm1.Create; begin Webbrowser1:= TWebBrowser.create; Webdings1:= TWebTool.create; end;
procedure TForm1.Button1Click(Sender: TObject); begin Webbrowser1.Navigate('http://www.'); Caption := Webbrowser1.OleObject.Document.Title; end;
procedure TForm1.WebBrowserDocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); begin if Webdings1.FillForm(WebBrowser1, 'search', 'foo') = False then ShowMessage('Error. Field not available or no Form found.'); end;
procedure TForm1.WebBrowserProgressChange(Sender: TObject; Progress, ProgressMax: Integer); begin if ProgressMax = 0 then begin label1.Caption := ''; Exit; end; try if (Progress <> -1) and (Progress <= ProgressMax) then label1.Caption := IntToStr((Progress * 100) div ProgressMax) + '% loaded...' else label1.Caption := ''; except on EDivByZero do Exit; end; end;
destructor TDemo.Destroy; begin Webbrowser1.Free; Webdings1.Free; inherited Destroy; end;
end. |
| Zitat: |
[Pascal Warning] Unit1.pas(22): W1010 Method 'Create' hides virtual method of base type 'TCustomForm'
[Pascal Error] Unit1.pas(34): E2035 Not enough actual parameters
[Pascal Error] Unit1.pas(4 : E2003 Undeclared identifier: 'FillForm'
[Pascal Error] Unit1.pas(57): E2003 Undeclared identifier: 'label1'
[Pascal Error] Unit1.pas(62): E2066 Missing operator or semicolon
[Pascal Error] Unit1.pas(64): E2066 Missing operator or semicolon
[Pascal Error] Unit1.pas(70): E2003 Undeclared identifier: 'TDemo'
[Pascal Error] Unit1.pas(72): E2003 Undeclared identifier: 'Webbrowser1'
[Pascal Error] Unit1.pas(72): E2066 Missing operator or semicolon
[Pascal Error] Unit1.pas(73): E2003 Undeclared identifier: 'Webdings1'
[Pascal Error] Unit1.pas(74): E2075 This form of method call only allowed in methods of derived types
[Pascal Hint] Unit1.pas(1 : H2219 Private symbol 'WebBrowserDocumentComplete' declared but never used
[Pascal Hint] Unit1.pas(19): H2219 Private symbol 'WebBrowserProgressChange' declared but never used
[Pascal Error] Unit1.pas(23): E2065 Unsatisfied forward or external declaration: 'TForm1.Destroy'
[Pascal Fatal Error] Project1.dpr(6): F2063 Could not compile used unit 'Unit1.pas' |
wtf?
|
|
GTA-Place
      

Beiträge: 5248
Erhaltene Danke: 2
WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
|
Verfasst: So 29.07.07 15:11
TForm1.Create ist kein Konstruktor sondern eine Prozedur der TForm. Doppelklick aufs Formular und da dann das ganze Create-Zeugs eintragen.
_________________ "Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
|
|
meskalin 
Hält's aus hier
Beiträge: 5
|
Verfasst: So 29.07.07 18:39
hab ich jetz gemacht und das kpommt dabei raus:
Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19:
| ... public procedure FormCreate(Sender: TObject); end;
var Form1: TForm1;
implementation
{$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin inherited Create; Webbrowser1:= TWebBrowser.create; Webdings1:= TWebTool.create; end; |
| Zitat: |
[Pascal Error] Unit1.pas(23): E2254 Overloaded procedure 'FormCreate' must be marked with the 'overload' directive
....// rest gleich
|
wenn ich beide male overload benutze kommt das raus:
| Zitat: |
[Pascal Error] Unit1.pas(23): E2267 Previous declaration of 'FormCreate' was not marked with the 'overload' directive |
leider finde ich nichts brauchbares weshalb man overload override reintroduce etc..
in konstruktoten verwendet alle bücher beschränken sich auf "constuctor create" und fertig.
muss man dan konsruktor der superklasse auch aufrufen wenn ja wie??
weshalb ist FormCreate eine prozedur weshalb verwendet man da nicht constuctor?

|
|
GTA-Place
      

Beiträge: 5248
Erhaltene Danke: 2
WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
|
Verfasst: So 29.07.07 18:46
Weil der Konstruktor sich in der Unit Forms.pas befindet. Entferne alles mit Form.Create (auch oben bei Public). Wechsle dann zum Form (F12) und klicke doppelt auf die Form (neben den Button1).
_________________ "Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
|
|
meskalin 
Hält's aus hier
Beiträge: 5
|
Verfasst: Mo 30.07.07 18:30
es geht immer noch nicht:
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: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72:
| unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, WebTool, SHDocVw;
type TForm1 = class(TForm) Button1: TButton; Webbrowser1: TWebBrowser; Webdings1: TWebTool; procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject); private procedure WebBrowserDocumentComplete(Sender: TObject;const pDisp: IDispatch; var URL: OleVariant); procedure WebBrowserProgressChange(Sender: TObject; Progress, ProgressMax: Integer); public end;
var Form1: TForm1; implementation
{$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin Webbrowser1:= TWebBrowser.create; Webdings1:= TWebTool.create; end; procedure TForm1.Button1Click(Sender: TObject); begin Webbrowser1.Navigate('http://www.'); Caption := Webbrowser1.OleObject.Document.Title; end; procedure TForm1.WebBrowserDocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); begin if Webdings1.FillForm(WebBrowser1, 'search', 'foo') = False then ShowMessage('Error. Field not available or no Form found.'); end; procedure TForm1.WebBrowserProgressChange(Sender: TObject; Progress, ProgressMax: Integer); begin if ProgressMax = 0 then begin label1.Caption := ''; Exit; end; try if (Progress <> -1) and (Progress <= ProgressMax) then label1.Caption := IntToStr((Progress * 100) div ProgressMax) + '% loaded...' else label1.Caption := ''; except on EDivByZero do Exit; end; end;
destructor TDemo.Destroy; begin Webbrowser1.Free; Webdings1.Free; inherited Destroy; end;
end. |
| Zitat: |
[Pascal Error] Unit1.pas(32): E2035 Not enough actual parameters
[Pascal Error] Unit1.pas(44): E2003 Undeclared identifier: 'FillForm'
[Pascal Error] Unit1.pas(52): E2003 Undeclared identifier: 'label1'
[Pascal Error] Unit1.pas(57): E2066 Missing operator or semicolon
[Pascal Error] Unit1.pas(59): E2066 Missing operator or semicolon
[Pascal Error] Unit1.pas(65): E2003 Undeclared identifier: 'TDemo'
[Pascal Error] Unit1.pas(67): E2003 Undeclared identifier: 'Webbrowser1'
[Pascal Error] Unit1.pas(67): E2066 Missing operator or semicolon
[Pascal Error] Unit1.pas(6 : E2003 Undeclared identifier: 'Webdings1'
[Pascal Error] Unit1.pas(69): E2075 This form of method call only allowed in methods of derived types
[Pascal Hint] Unit1.pas(1 : H2219 Private symbol 'WebBrowserDocumentComplete' declared but never used
[Pascal Hint] Unit1.pas(19): H2219 Private symbol 'WebBrowserProgressChange' declared but never used
[Pascal Fatal Error] Project1.dpr(6): F2063 Could not compile used unit 'Unit1.pas'
|
beim compilerien kommt noch:
field Form1->Webdings1 does not have a crresponding komponent
field Form1->Webbrowser1 does not have a crresponding komponent
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:
| unit WebTool;
interface uses SHDocVw; type TWebTool =class
public function FillForm(var WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean; end;
implementation
function FillForm(var WebBrowser: TWebBrowser; FieldName: string; Value: string): Boolean; var i, j: Integer; FormItem: Variant; begin Result := False; if WebBrowser.OleObject.Document.all.tags('FORM').Length = 0 then begin Exit; end; for I := 0 to WebBrowser.OleObject.Document.forms.Length - 1 do begin FormItem := WebBrowser.OleObject.Document.forms.Item(I); for j := 0 to FormItem.Length - 1 do begin try if FormItem.Item(j).Name = FieldName then begin FormItem.Item(j).Value := Value; Result := True; end; except Exit; end; end; end; end;
end. |
| Zitat: |
[Pascal Error] WebTool.pas( : E2065 Unsatisfied forward or external declaration: 'TWebTool.FillForm'
[Pascal Fatal Error] Unit1.pas(6): F2063 Could not compile used unit 'WebTool.pas'
|
kannst du bitte den code korrigeren ich weiss echt nicht mehr weiter.
|
|
GTA-Place
      

Beiträge: 5248
Erhaltene Danke: 2
WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
|
Verfasst: Mo 30.07.07 21:59
Delphi-Quelltext 1:
| Webbrowser1 := TWebBrowser.Create(Self); |
Wenn das andere dann noch immer nicht geht guck ich da morgen mal genauer.
_________________ "Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
|
|
meskalin 
Hält's aus hier
Beiträge: 5
|
Verfasst: Di 31.07.07 17:00
ich habe nun den TWebbrowser entfernt und neu eingebunden, jetzt sind die fehlermeldungen vom TWebbrowser weg, aber meine TWebTool klasse die ich geschrieben hab lässt sich nicht einbinden wahrscheinlich nimmt Delphi an dass es ein gui element ist, was aber nicht der fall ist.
wie bindet man eigene units und klassen richtig ein, händisch scheint es nicht zu funzen?
der destruktor funtz auch noch nicht.
die TWebTool klasse sollte die funktionalität etwas von der gui trennen.
|
|
|