📄 untsysfaced.pas
字号:
{*******************************************************}
{ }
{ 单元名称: UntSysFaceD }
{ 创建日期: 2005-08-28 }
{ 摘要说明: TSysCom.dll动态加载接口 }
{ }
{ 详细说明: }
{ }
{ 参 阅: }
{ }
{ 已知问题: }
{ }
{ 待作事项: }
{ }
{ 作 者: 胡孟杰 }
{ Copyright (C) 2005 FdAuto }
{ 当前版本: 1.0 }
{ 版本历史: }
{ }
{*******************************************************}
unit UntSysFaceD;
{==========================================================================
单元接口部分
==========================================================================}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Variants, ShellAPI, CoolTrayIcon;
{==========================================================================
函数类型声明部分
==========================================================================}
type
TOpenURL = procedure(URL: PChar); stdcall; // external 'TSysCom.dll';
TGetExePath = function(): PChar; stdcall; //external 'TSysCom.dll';
{==========================================================================
接口函数声明
==========================================================================}
procedure ShowMsg(Msg: string); stdcall;
procedure ShowInfo(Msg: string); stdcall;
procedure OpenURL(URL: string); stdcall; //打开外部文件
function GetExePath(): string; stdcall; //取得当前EXE路径
{==========================================================================
单元、函数实现部分
==========================================================================}
implementation
uses UntMain;
procedure ShowMsg(Msg: string); stdcall;
begin
Application.MessageBox(PChar(Msg),
PChar(Application.Title), MB_ICONINFORMATION);
end;
procedure ShowInfo(Msg: string); stdcall;
begin
FormMain.CoolTrayIcon1.ShowBalloonHint('Delphi程序员助手提示', Msg, bitInfo, 10);
end;
{==========================================================================
过程名: OpenExe
功 能: 函数调用OpenURL接口
参 数: URL
作 者: 胡孟杰
日 期: 2005.08.26
==========================================================================}
procedure OpenURL(URL: string); stdcall;
var
FHandle : THandle;
FOpenURL : TOpenURL;
begin
FHandle := LoadLibrary('TSysCom.dll');
if FHandle <> 0 then
begin
@FOpenURL := GetProcAddress(FHandle, 'OpenURL');
if @FOpenURL <> nil then
FOpenURL(PChar(URL))
else
ShowMsg(PChar('加载函数OpenURL失败!'));
end
else
ShowMsg(PChar('加载TSysCom.dll失败!'));
FreeLibrary(FHandle);
end;
{==========================================================================
函数名: GetExePath
功 能: 函数GetExePath接口
参 数: 无
返回值: 当前EXE路径
作 者: 胡孟杰
日 期: 2005.08.26
==========================================================================}
function GetExePath(): string; stdcall;
var
FHandle : THandle;
FGetExePath : TGetExePath;
begin
result := '';
FHandle := LoadLibrary('TSysCom.dll');
if FHandle <> 0 then
begin
@FGetExePath := GetProcAddress(FHandle, 'GetExePath');
if @FGetExePath <> nil then
result := StrPas(FGetExePath())
else
ShowMsg(PChar('加载函数GetExePath失败!'));
end
else
ShowMsg(PChar('加载TSysCom.dll失败!'));
FreeLibrary(FHandle);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -