Jump to content

Archived

This topic is now archived and is closed to further replies.

Guest rekin22a

Delphi to C++ Builder ...

Recommended Posts

Guest rekin22a

Mam problem użyłem programu Delphi to C++ Builder i kod wgrywam do devc++ i nie działa wychodzą błędy.

Chcialem zrobić przeglądarke taką jak da sie zrobić w delphi.Nie moge zainstalowac delphi poniewaz sciagalbym ja przy blueconnect 2 dni.Prosiłbym jak ktoś mógłby to przekonwertować byłbym wdzięczny

Kod delphi:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, ExtCtrls, OleCtrls, SHDocVw, StdCtrls, ComCtrls;

type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
Panel1: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
Panel2: TPanel;
Edit1: TEdit;
SpeedButton5: TSpeedButton;
StatusBar1: TStatusBar;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
Label1: TLabel;
ProgressBar1: TProgressBar;
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
procedure WebBrowser1ProgressChange(Sender: TObject; Progress,
ProgressMax: Integer);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure WebBrowser1NewWindow2(Sender: TObject; var ppDisp: IDispatch;
var Cancel: WordBool);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
WebBrowser1.GoBack; // wstecz
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
WebBrowser1.GoForward; //dalej
end;

procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
WebBrowser1.Stop; //stop
end;

procedure TForm1.SpeedButton4Click(Sender: TObject);
begin
WebBrowser1.Refresh; //odśwież
end;

procedure TForm1.SpeedButton5Click(Sender: TObject);
begin
WebBrowser1.Navigate(Edit1.Text); //przejdź do strony podanej w Edit1
end;

procedure TForm1.SpeedButton6Click(Sender: TObject);
begin
close; //
end;

procedure TForm1.SpeedButton7Click(Sender: TObject);
begin
WebBrowser1.GoHome; // idz do strony startowej
end;

procedure TForm1.SpeedButton8Click(Sender: TObject);
begin
WebBrowser1.Navigate('http://www.google.pl/'); // idz do google.pl (wyszukiwarka)
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
WebBrowser1.Navigate('http://www.jadominik.cba.pl'); // strona startowa tej przeglądarki
end;

procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
Edit1.Text:= WebBrowser1.LocationURL; // wyświetl adres strony w Edicie
Label1.Caption:= 'Gotowe'; // jak się strona załaduje to pokaż na labelu napis że się załadowała
end;

procedure TForm1.WebBrowser1ProgressChange(Sender: TObject; Progress,
ProgressMax: Integer);
begin
ProgressBar1.Max := ProgressMax; ProgressBar1.Position := Progress; // po prostu progress
end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then SpeedButton5.Click; // działa enter w edicie
end;

procedure TForm1.WebBrowser1NewWindow2(Sender: TObject;
var ppDisp: IDispatch; var Cancel: WordBool);
var
NewWindow: TForm1;
begin
NewWindow := TForm1.Create(self); .
NewWindow.Show;
ppDisp := NewWindow.Webbrowser1.DefaultDispatch;
end;

end.

Po przeróbce programe,

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, ExtCtrls, OleCtrls, SHDocVw, StdCtrls, ComCtrls;

type
TForm1 == class(TForm)
TWebBrowser WebBrowser1;
TPanel Panel1;
TSpeedButton SpeedButton1;
TSpeedButton SpeedButton2;
TSpeedButton SpeedButton3;
TSpeedButton SpeedButton4;
TPanel Panel2;
TEdit Edit1;
TSpeedButton SpeedButton5;
TStatusBar StatusBar1;
TSpeedButton SpeedButton6;
TSpeedButton SpeedButton7;
TSpeedButton SpeedButton8;
T 1:
TProgressBar ProgressBar1;
TObject) procedure SpeedButton1Click(Sender;
TObject) procedure SpeedButton2Click(Sender;
TObject) procedure SpeedButton3Click(Sender;
TObject) procedure SpeedButton4Click(Sender;
TObject) procedure SpeedButton5Click(Sender;
TObject) procedure SpeedButton6Click(Sender;
TObject) procedure SpeedButton7Click(Sender;
TObject) procedure SpeedButton8Click(Sender;
TObject) procedure FormCreate(Sender;
TObject procedure WebBrowser1DocumentComplete(Sender;
IDispatch { URL: OleVariant); const pDisp;
TObject Progress, procedure WebBrowser1ProgressChange(Sender;
int ) ProgressMax;
TObject var Key: Char); procedure Edit1KeyPress(Sender;
TObject var ppDisp: IDispatch; procedure WebBrowser1NewWindow2(Sender;
WordBool) var Cancel;
private
/* Private declarations */
public
/* Public declarations */
}

var
TForm1 Form1;

implementation

/*$R *.dfm*/

TObject) procedure TForm1->SpeedButton1Click(Sender;

WebBrowser1->GoBack; // wstecz
}

TObject) procedure TForm1->SpeedButton2Click(Sender;
{
WebBrowser1->GoForward; //dalej
}

TObject) procedure TForm1->SpeedButton3Click(Sender;
{
WebBrowser1->Stop; //stop
}

TObject) procedure TForm1->SpeedButton4Click(Sender;
{
WebBrowser1->Refresh; //odśwież
}

TObject) procedure TForm1->SpeedButton5Click(Sender;
{
WebBrowser1->Navigate(Edit1->Text); //przejdź do strony podanej w Edit1
}

TObject) procedure TForm1->SpeedButton6Click(Sender;
{
close; // smile_prosty.gif
}

TObject) procedure TForm1->SpeedButton7Click(Sender;
{
WebBrowser1->GoHome; // idz do strony startowej
}

TObject) procedure TForm1->SpeedButton8Click(Sender;
{
WebBrowser1->Navigate("http://www.google.pl/"); // idz do google->pl (wyszukiwarka)
}

TObject) procedure TForm1->FormCreate(Sender;
{
WebBrowser1->Navigate("http://www.jadominik.cba.pl"); // strona startowa tej przeglądarki tongue_prosty->gif
}

TObject procedure TForm1->WebBrowser1DocumentComplete(Sender;
IDispatch { URL: OleVariant); const pDisp;

Edit1->Text= WebBrowser1->LocationURL; // wyświetl adres strony w Edicie
1->Caption= "Gotowe"; // jak się strona załaduje to pokaż na labelu napis że się załadowała
}

TObject Progress, procedure TForm1->WebBrowser1ProgressChange(Sender;
int ) ProgressMax;
{
ProgressBar1->Max = ProgressMax; ProgressBar1->Position = Progress; // po prostu progress
}

TObject { Key: Char); procedure TForm1->Edit1KeyPress(Sender;

if(Key == #13 ) SpeedButton5->Click; // działa enter w edicie
}

TObject procedure TForm1->WebBrowser1NewWindow2(Sender;
IDispatch { Cancel: WordBool); var ppDisp;
var
TForm1 NewWindow;

NewWindow = TForm1->Create(self); ->
NewWindow->Show;
ppDisp = NewWindow->Webbrowser1->DefaultDispatch;
}

}

Link to comment
Share on other sites



  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...