{ HoverDesk Clock Plugin Exemple } { Copyright (c)2000 - Thibaud DJIAN } { Code Source : Delphi v4.x or above } { HoverDesk : Customize your Desktop ! } { Futur web : http://www.glabouni.com/hoverdesk } { Forum : http://hoverdesk.deviantart.com } { email : tdjian@glabouni.com } library HDClock; { Name of your plugin DLL } { CAUTION : when creating a new plugin for HoverDesk } { put the HDPLUGINI.DLL in your project folder } { USAGE : Simply create your own Component/Control in Delphi } { Then insert your component like below ...... } Uses Controls,Forms,Windows, NextClock; { THIS IS YOUR COMPONENT ! Here, my Custom Clock Component } { DECLARATIONS IN ORDER TO USE THE FUNCTIONS IN HDPLUGINI.DLL } { USED TO READ / WRITE SETTINGS IN THE MODULES.INI FILE } procedure WriteIniHDPlug( Section, Match, Value : string); external 'hdplugini.dll'; function ReadIniHDPlug( Section, Match : string) : PChar; external 'hdplugini.dll'; { Let's Begin ............ } var OwnerApp: Integer; FForm : TForm; { Your component object. Here my custom clock component } NB : TNextClock; { Function for HoverDesk to retreive the name of your plugin } { Put here the name of your plug } function GetName: Pchar; far; begin Result := 'HoverClock'; end; { This Function must be insert for HoverDesk } function GetForm: TForm; far; begin Result := FForm; end; { This Function must be insert for HoverDesk } function GetControl: TControl; far; begin Result := NB; end; { Ok, let's initialize your component with his properties } { Here, in my Clock Component, the Properties are : } { - Texture : bitmap texture used for the plugin } { - Mode12 : mode AM/PM for the clock } { - Tiny : Clock in tiny mode eg will show only the time } procedure InitPlug(Owner: Integer); far Begin { Important for HoverDesk ! } OwnerAPP := Owner; FForm:=TForm.Create(nil); FForm.BorderStyle:=bsNone; SetWindowLong(FForm.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); { Create your component } NB:=TNextClock.Create(FForm); { Used for HoverDesk when you Shift+Clic on the plugin for moving it } NB.OnMouseDown:=FForm.OnMouseDown; { Let's insert the component in the form + set the width/height of the plugin } FForm.InsertControl(NB); FForm.Width:=NB.Width; FForm.Height:=NB.Height; { Important for HoverDesk ! } NB.Tag:=FForm.Handle; { Let's set the component Properties via the HDPLUGINI.DLL } { Function ReadIniHDPlug(Section,Match : String) : String } { This function will return the Text after the "=" } { for the match you're looking for in the section you've specified } { For exemple : } { NB.Texture:=ReadIniHDPlug('[HDCLOCK]','texture'); } { retun text after 'texture =' in the file Modules.ini, found in the section [HDCLOCK] } { CAUTION : All plugins properties are stored and read in the Modules.ini file } { You can set any section name, but use one that don't already exists } NB.Texture:=ReadIniHDPlug('[HDCLOCK]','texture'); NB.Mode12:=ReadIniHDPlug('[HDCLOCK]','ampm')='1'; NB.Tiny:=ReadIniHDPlug('[HDCLOCK]','tiny')='1'; { Let's start the clock timer ... } NB.Start:=true; end; { Let's Free the plugin if HoverDesk doesn't need it } procedure FreePlug;far; begin { We stop the Clock timer } NB.Start:=false; { we store our new component properties in the Modules.ini file } { CAUTION : if the section doesn't exists, the HoverDesk will create a new one !} { Here, you will have in the file Modules.ini, something like : } // [HDCLOCK] // texture = mytexturebitmap WriteIniHDPlug('[HDCLOCK]','texture',NB.Texture); { Storing the boolean properties for the component in the file Modules.ini } If NB.Mode12 Then WriteIniHDPlug('[HDCLOCK]','ampm','1') Else WriteIniHDPlug('[HDCLOCK]','ampm','0'); If NB.Tiny Then WriteIniHDPlug('[HDCLOCK]','tiny','1') Else WriteIniHDPlug('[HDCLOCK]','tiny','0'); { Let's Free the component } NB.Free; { Let's Free the Form } FForm.Close; FForm.Free; End; { This lines MUST be added for HoverDesk } { exporting all the functions } Exports InitPlug,FreePlug,GetName,GetForm,GetControl; Begin End.