![]() |
{$Resource HTML.res}/ html aus Ressource in Webbrowser laden
Hallo,
ich habe eine html und ein Bild in Ressource
Delphi-Quellcode:
Wie kann ich mein index.html aus Ressource in meinen Webbrowser1 laden?
//.rC :
index HTML "index.html" bild1 BILDER "logo.gif" Wer kann mir weiter helfen :
Delphi-Quellcode:
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, SHDocVw, StdCtrls; type TForm1 = class(TForm) Button1: TButton; WebBrowser1: TWebBrowser; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} {$Resource HTMLs.res} // um html aus Res in Webbrowser zu laden brauche ich eine Fuktion procedure TForm1.LoadvonRessource(htmls:string); var Adress: string; index: array[0..255] of Char; begin GetModuleFileName(hInstance, index, SizeOf(index)); Adress:='res://' + StrPas(index) + '/RT_HTML/'+HTMLS; WebBrowser1.Navigate(Adress); end; procedure TForm1.Button1Click(Sender: TObject); begin Webbrowser1.navigate(adress); //Webbrowser1.navigate('index.htm'); end; end. |
Re: {$Resource HTML.res}/ html aus Ressource in Webbrowser l
Was geht denn an Deinem Code nicht?
Was hast Du bisher versucht, um an die Lösung zu kommen. Wird das ein weiterer Teil nach dem Motto: "Ich will dies und jenes erreichen, macht mir das mal bitte" ? Du scheinst Dich an einem Bereich zu versuchen, der für Deine Menge an Grundwissen eindeutig zu komplex ist. |
Re: {$Resource HTML.res}/ html aus Ressource in Webbrowser l
Zitat:
Aber leider wird die html in Webbrowser1 nicht geladen :( Die Frage wie muss der Code von Button1 sein, damit die html von Resource in Webbrowser geladen wird?
Delphi-Quellcode:
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, SHDocVw; type TForm1 = class(TForm) Button1: TButton; WebBrowser1: TWebBrowser; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private procedure LoadvonRessource(htmls:string); { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} {$R htmls.res} procedure TForm1.LoadvonRessource(htmls:string); var Adress: string; index: array[0..255] of Char; begin GetModuleFileName(hInstance, index, SizeOf(index)); Adress:='res://' + StrPas(index) + '/RT_HTML/'+htmls; WebBrowser1.Navigate(Adress); end; procedure TForm1.Button1Click(Sender: TObject); var Adress: string; begin LoadvonRessource('INDEX'); WebBrowser1.Navigate(Adress); end; procedure TForm1.FormCreate(Sender: TObject); begin webBrowser1.Navigate('about:blank'); end; end. |
Re: {$Resource HTML.res}/ html aus Ressource in Webbrowser l
Das Protokoll "res" kenne ich noch nicht.
|
Re: {$Resource HTML.res}/ html aus Ressource in Webbrowser l
Zitat:
soll nun der Schüller dem Lehrer helfen? :mrgreen:
Delphi-Quellcode:
The 'res:' Protocol
The 'res:' protocol lets you extract a resource from a compiled module like an EXE or DLL. While this protocol has been introduced to work with HTML pages, you can use it to work with other type of resources as well, including custom resources. A URL based on this protocol looks like this: res://resource_file.ext[/resource_type]/{res_id} |
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:46 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz