Componentes.Terceros.RemObj.../official/5.0.35.741/Everwood/Source/Delphi/uEWTools.pas
2009-02-27 15:16:56 +00:00

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.