?? 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;
{==========================================================================
函數類型聲明部分
==========================================================================}
Type
TOpenURL = procedure (URL : PChar); stdcall; // external 'TSysCom.dll';
TGetExePath = function () : PChar; stdcall; //external 'TSysCom.dll';
{==========================================================================
接口函數聲明
==========================================================================}
procedure ShowMsg( Msg : string ); stdcall;
procedure OpenURL(URL : string); stdcall; //打開外部文件
function GetExePath(): string; stdcall; //取得當前EXE路徑
{==========================================================================
單元、函數實現部分
==========================================================================}
implementation
procedure ShowMsg( Msg : string ); stdcall;
begin
Application.MessageBox(PChar(Msg),
PChar(Application.Title), MB_ICONINFORMATION);
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失?。?#039;));
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失?。?#039;));
FreeLibrary(FHandle);
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -