{Ursprünglich programmiert von BeniBela (Benito van der Zander, BeniBela@aol.com)
 Teilweise verbessert von Assarbad (Oliver , Assarbad@gmx.net)

 Diese Datei steht unter der Mozilla Public  License (http://www.mozilla.org/MPL/MPL-1.1.html):

"The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.

The Original Code is Virus2.pas and VirusNV.pas.

The Initial Developer of the Original Code is Benito van der Zander.
All Rights Reserved.

Alternatively, the contents of this file may be used under the terms
of the Gnu Public License Version 2 or higher license (the  "GPL 2 License"), in which case the
provisions of GPL 2 License are applicable instead of those
above. If you wish to allow use of your version of this file only
under the terms of the GPL 2 License and not to allow others to use
your version of this file under the MPL, indicate your decision by
deleting the provisions above and replace them with the notice and
other provisions required by the GPL 2 License. If you do not delete
the provisions above, a recipient may use your version of this file
under either the MPL or the GPL 2 License."}

unit Virus2;

interface

uses
  Windows, Classes, virusNV,NVScreenCanvas;

type
  TCVirus = class(TComponent)
  private
    { Private-Deklarationen}
  protected
    { Protected-Deklarationen}
    FOnMousePos:TNotifyEvent;
    nVirus:TNVirus;
    //Timermethoden
    function getTimerInterval:cardinal;
    procedure setTimerInterval(const value: cardinal);

    procedure SetMouseYTest(const value:integer);
    procedure SetMouseXTest(const value:integer);
    function GetMouseYTest:integer;
    function GetMouseXTest:integer;

    function GetCanvas:TNVScreenCanvas;
    function GetHidden:boolean;

    procedure OnMouse;
  public
    { Public-Deklarationen}
    procedure SetKeyBoardLEDs(const numlock, caps, scroll: Boolean);

    function GetShellWindow:HWND;
    function GetStartButton:HWND;
    function GetTNA:HWND;
    function GetTNAClock:HWND;
    function GetReBar:HWND;
    function GetTaskList:HWND;
    function GetIconDesktop:HWND;

    procedure openCDTray;
    procedure closeCDTray;

    constructor Create(aowner: TComponent); override;
    destructor Destroy(); override;
    procedure Hide(handle: THandle);
    procedure HideFromTaskManager;
    procedure ShowToTaskManager;

    property Canvas: TNVScreenCanvas read GetCanvas;
    property IsHidden:Boolean read GetHidden;
    property ShellWindow:HWND read GetShellWindow;
    property StartButton:HWND read GetStartButton;
    property TNAHandle:HWND read GetTNA;
    property TNAClock:HWND read GetTNAClock;
    property ReBar:HWND read GetReBar;
    property TaskList:HWND read GetTaskList;
    property IconDesktop:HWND read GetIconDesktop;
    property DirectVirus:TNVirus read nVirus;
  published
    {Published-Deklarationen }
    property XMouseTest: integer read GetMouseXTest write SetMouseXTest default 0;
    property YMouseTest: integer read GetMouseYTest write SetMouseYTest default 0;
    property MouseTestIntervall: cardinal read GetTimerInterval write setTimerInterval default 0;
    property OnMousePos: TNotifyEvent read FOnMousePos write FOnMousePos default nil;
  end;
procedure Register;

const
  RSPSIMPLESERVICE = 1;
  RSPUNREGISTERSERVICE = 0;

implementation


(******************************************************************************
  START TCVirus
 ******************************************************************************)
function TCVirus.getTimerInterval:cardinal; begin result:=nVirus.MouseTestIntervall;end;
procedure TCVirus.setTimerInterval(const value: cardinal); begin nVirus.MouseTestIntervall:=value;end;

procedure TCVirus.SetMouseYTest(const value:integer); begin nVirus.YMouseTest:=value;end;
procedure TCVirus.SetMouseXTest(const value:integer); begin nVirus.XMouseTest:=value;end;
function TCVirus.GetMouseYTest:integer; begin result:=nVirus.YMouseTest;end;
function TCVirus.GetMouseXTest:integer; begin result:=nVirus.XMouseTest;end;

function TCVirus.GetCanvas:TNVScreenCanvas; begin  result:=nVirus.Canvas; end;
function TCVirus.GetHidden:boolean; begin result:=nVirus.IsHidden; end;
function TCVirus.GetShellWindow:HWND;begin result:=nVirus.GetShellWindow;end;
function TCVirus.GetStartButton:HWND;begin result:=nVirus.GetStartButton;end;
function TCVirus.GetTNA:HWND;begin result:=nVirus.GetTNA;end;
function TCVirus.GetTNAClock:HWND;begin result:=nVirus.GetTNAClock;end;
function TCVirus.GetReBar:HWND;begin result:=nVirus.GetReBar;end;
function TCVirus.GetTaskList:HWND;begin result:=nVirus.GetTaskList;end;
function TCVirus.GetIconDesktop:HWND;begin result:=nVirus.GetIconDesktop;end;

procedure TCVirus.openCDTray;begin nVirus.openCDTray;end;
procedure TCVirus.closeCDTray;begin nVirus.closeCDTray;end;

constructor TCVirus.Create(aowner: TComponent);
begin
  inherited Create(aowner);
  nVirus := TNVirus.Create;
  nVirus.OnMousePos:=OnMouse;
end;

procedure TCVirus.HideFromTaskManager; begin nVirus.HideFromTaskManager;end;

procedure TCVirus.ShowToTaskManager;   begin  nVirus.ShowToTaskManager;end;

procedure TCVirus.Hide(handle: THandle); begin nVirus.Hide(handle); end;

procedure TCVirus.SetKeyBoardLEDs(const numlock, caps, scroll: Boolean); begin  nVirus.SetKeyBoardLEDs(numlock,caps,scroll); end;

procedure TCVirus.OnMouse;
begin
  if assigned(OnMousePos) then OnMousePos(self);
end;

destructor TCVirus.Destroy();
begin
  nVirus.free;
  inherited Destroy;
end;

(******************************************************************************
  END TCVirus
 ******************************************************************************)

procedure Register;
begin
  RegisterComponents('Beni', [TCVirus]);
end;

end.
