git-svn-id: https://192.168.0.254/svn/Componentes.Terceros.RemObjects@46 b6239004-a887-0f4b-9937-50029ccdca16
84 lines
2.2 KiB
ObjectPascal
84 lines
2.2 KiB
ObjectPascal
unit uEWTools;
|
|
|
|
{$I Everwood.inc}
|
|
|
|
interface
|
|
{$IFDEF MSWINDOWS}
|
|
uses
|
|
Windows;
|
|
function IsKeyDown(VirtualKeyCode:Integer=VK_SHIFT): Boolean;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF FPC}
|
|
|
|
{$IFNDEF MSWINDOWS}
|
|
type
|
|
HWND = cardinal;
|
|
HINST = integer;
|
|
const
|
|
SW_NORMAL = 1;
|
|
SW_SHOWNORMAL = 1;
|
|
{$ENDIF}
|
|
function RO_ShellExecute(hWnd: HWND; Operation, FileName, Parameters, Directory: PChar; ShowCmd: Integer): HINST;
|
|
function RO_ShellExecuteA(hWnd: HWND; Operation, FileName, Parameters, Directory: PAnsiChar; ShowCmd: Integer): HINST;
|
|
function RO_ShellExecuteW(hWnd: HWND; Operation, FileName, Parameters, Directory: PWideChar; ShowCmd: Integer): HINST;
|
|
{$ENDIF}
|
|
|
|
implementation
|
|
|
|
{$IFDEF FPC}
|
|
uses
|
|
{$IFDEF MSWINDOWS}
|
|
ShellAPI;
|
|
{$ELSE}
|
|
SysUtils;
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
function IsKeyDown(VirtualKeyCode:Integer=VK_SHIFT): Boolean;
|
|
begin
|
|
Result := GetKeyState(VirtualKeyCode) and $80 <> 0;
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF FPC}
|
|
function RO_ShellExecute(hWnd: HWND; Operation, FileName, Parameters, Directory: PChar; ShowCmd: Integer): HINST;
|
|
begin
|
|
{$IFDEF MSWINDOWS}
|
|
Result:=ShellExecute(hWnd, Operation,FileName,Parameters,Directory,ShowCmd);
|
|
{$ELSE}
|
|
if Parameters <> nil then
|
|
Result:=ExecuteProcess(String(Directory),String(Filename)+' '+String(Parameters))
|
|
else
|
|
Result:=ExecuteProcess(String(Directory),String(Filename))
|
|
{$ENDIF}
|
|
end;
|
|
|
|
function RO_ShellExecuteA(hWnd: HWND; Operation, FileName, Parameters,Directory: PAnsiChar; ShowCmd: Integer): HINST;
|
|
begin
|
|
{$IFDEF MSWINDOWS}
|
|
Result:=ShellExecuteA(hWnd, Operation,FileName,Parameters,Directory,ShowCmd);
|
|
{$ELSE}
|
|
if Parameters <> nil then
|
|
Result:=ExecuteProcess(Ansistring(Directory),Ansistring(Filename)+' '+Ansistring(Parameters))
|
|
else
|
|
Result:=ExecuteProcess(Ansistring(Directory),Ansistring(Filename))
|
|
{$ENDIF}
|
|
end;
|
|
|
|
function RO_ShellExecuteW(hWnd: HWND; Operation, FileName, Parameters,Directory: PWideChar; ShowCmd: Integer): HINST;
|
|
begin
|
|
{$IFDEF MSWINDOWS}
|
|
Result:=ShellExecuteW(hWnd, Operation,FileName,Parameters,Directory,ShowCmd);
|
|
{$ELSE}
|
|
if Parameters <> nil then
|
|
Result:=ExecuteProcess(WideString(Directory),WideString(Filename)+' '+WideString(Parameters))
|
|
else
|
|
Result:=ExecuteProcess(WideString(Directory),WideString(Filename))
|
|
{$ENDIF}
|
|
end;
|
|
{$ENDIF}
|
|
|
|
end.
|