⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ushowhtml.pas

📁 监听TCP、UDP端口,查看进程及服务.
💻 PAS
字号:
unit UShowHTML;

interface

uses
   ComObj,ActiveX,Windows,Sysutils,Classes,Forms;

procedure LibShowHTMLDialog(ParentHandle: HWND; Moniker: IMoniker;
  DialogArguments: PVariant; Options: PWideChar; ReturnValue: PVariant);

procedure ShowHTMLDialog(ParentHandle: HWND; ImageName, ResName: string);

type
  TShowHTMLDialogLibFunc = function (hwndParent: HWND; Moniker: IMoniker;
    pvarArgIn: PVariant; pchOptions: PWideChar; pvarArgOut: PVariant):
    HResult; stdcall;
  TCreateURLMonikerLibFunc = function (MkCtx: IMoniker; szURL: LPCWSTR; out mk: IMoniker):
    HResult; stdcall;

implementation

procedure LibShowHTMLDialog(ParentHandle: HWND; Moniker: IMoniker;
  DialogArguments: PVariant; Options: PWideChar; ReturnValue: PVariant);
const
  LibName = 'MSHTML.DLL';
  FuncName = 'ShowHTMLDialog';
var
  LibInstance: THandle;
  LibFunc: TShowHTMLDialogLibFunc;
  Res: HResult;
begin
  LibInstance := LoadLibrary(LibName);
  if LibInstance = 0 then RaiseLastWin32Error;
  try
    LibFunc := TShowHTMLDialogLibFunc(GetProcAddress(LibInstance, FuncName));
    if not Assigned(LibFunc) then
      raise Exception.Create('MSHTML.DLL does not export ShowHTMLDialog');
    Res := LibFunc(ParentHandle, Moniker, DialogArguments, Options, ReturnValue);
    OleCheck(Res);
  finally
    FreeLibrary(LibInstance);
  end;
end;

procedure ShowHTMLDialog(ParentHandle: HWND; ImageName, ResName: string);
const
  LibName = 'URLMON.DLL';
  FuncName = 'CreateURLMoniker';
var
  LibInstance: THandle;
  CreateURLMonikerFunc: TCreateURLMonikerLibFunc;
  Moniker: IMoniker;
  URL: WideString;
begin
  // If no image is specified, us the application.
  if ImageName = '' then
    ImageName := Application.EXEName;
  // Build the URL using the res: protocol.
  URL := 'res://' + ImageName + '/' + ResName;

  LibInstance := LoadLibrary(LibName);
  if LibInstance = 0 then
    RaiseLastWin32Error;
  try
    CreateURLMonikerFunc := TCreateURLMonikerLibFunc(
      GetProcAddress(LibInstance, FuncName));
    OleCheck(CreateURLMonikerFunc(nil, PWideChar(URL), Moniker));
    LibShowHTMLDialog(ParentHandle, Moniker, nil, nil, nil);
  finally
    FreeLibrary(LibInstance);
  end;
end;


end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -