我正在尝试在Delphi XE2中创建一个DLL,它将弹出一个带有TWebBrowser组件的表单.调用WebBrowser.Navigate2方法时,应用程序结束时不会调用单元(或任何单元)的终结部分.如果未调用Navigate2,则终结部分就好了.
dll正在从C++(VS 2010 MFC控制台)调用,并通过导入库链接.
还有其他方法可以做到这一点,但我想重用我们已编写的代码.
有谁知道发生了什么事?
谢谢.
这是一个简单的问题重演:
library DisplayPatientAlertsIntf;
exports DisplayPatientAlertsA name 'DisplayPatientAlertsA@4';
begin
end.
unit uAlertWindow;
interface
uses
Winapi.ActiveX,
Forms,
SHDocVw,
Graphics, Controls;
function DisplayPatientAlertsA(PatientID : PAnsiChar): Integer; export; stdcall;
implementation
var ts : TStringList;
function DisplayPatientAlertsA(PatientID : PAnsiChar): Integer; export; stdcall;
var Form1 : TForm;
WebBrowser1 : TWebBrowser;
DidCoInit : Boolean;
begin
DidCoInit := Succeeded(CoInitialize(nil));
try
Form1 := TForm.Create(nil);
try
WebBrowser1 := TWebBrowser.Create(nil);
try
WebBrowser1.ParentWindow := Form1.Handle;
WebBrowser1.Align := alClient;
WebBrowser1.Navigate2('file://c:\temp.html');
Form1.ShowModal;
finally
WebBrowser1.Free;
end;
finally …Run Code Online (Sandbox Code Playgroud) 我已将此URL加密为base64,这是一个动画QRCode。
我如何在TWebBrowser(或TImage)中加载它?提前致谢。
编辑:
这是我的尝试,但没有成功:
uses
IdHTTP, IdSSLOpenSSL, GIFImg, ClipBrd;
type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function GetStrFromClipbrd: string;
begin
if Clipboard.HasFormat(CF_TEXT) then
Result := Clipboard.AsText
else
begin
ShowMessage('There is no text in the Clipboard!');
Result := '';
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
MS: TMemoryStream;
IdHTTP1: TIdHTTP;
GIF: TGIFImage; …Run Code Online (Sandbox Code Playgroud) 我正在使用Delphi 2009,我想找到包含给定元素的HTML表索引.
因此,在我创建的应用程序中,我使用Web浏览器来查看网页.我想从这个页面中选择元素,并希望获得包含该元素的表的索引.
如果有人能做到,请帮助我
我尝试在Delphi 10.1 Berlin中使用twebbrowser上传文件.一切都很好但是当我尝试加载unicode文件时,delphi给了我一个错误"将类型(Word)的变体转换为类型(字节)时溢出".我如何修复unicode文件?
procedure UploadFilesHttpPost(const wb:TWebBrowser; const URLstring: string; names, values, nFiles, vFiles: array of string) ;
var
strData, n, v, boundary: string;
URL: OleVariant;
Flags: OleVariant;
PostData: OleVariant;
Headers: OleVariant;
idx: Integer;
ms: TMemoryStream;
ss: TStringStream;
List: TStringList;
begin
if (Length(names) <> Length(values)) then
raise Exception.Create('UploadFilesHttpPost: Names and Values must have the same length.') ;
if (Length(nFiles) <> Length(vFiles)) then
raise Exception.Create('UploadFilesHttpPost: FileNames and FileValues must have the same length.') ;
URL := 'about:blank';
Flags := NavNoHistory or NavNoReadFromCache …Run Code Online (Sandbox Code Playgroud)