Code:
Code: Alles auswählen
library mirc_dll;
{$mode delphi}
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Windows,
Classes;
type
TLoadInfo = packed record
mVersion : DWORD;
mHwnd : HWND;
mKeep : Boolean;
end;
PLoadInfo = ^TLoadInfo;
//{$R *.RES}
(*
This function is the first function being called when mIRC loads the dll.
*)
procedure LoadDll(LoadInfo: PLoadInfo); stdcall; export;
begin
LoadInfo.mKeep := TRUE; // Tells mIRC to keep our DLL loaded
end;
(*
This is the closing function of the DLL
- It is either called when you close your DLL manually,
or after ten minutes of no calls to the DLL.
*)
procedure UnloadDll(mTimeOut: integer); stdcall; export;
begin
case mTimeOut of
0: messagebox(0, 'Unloading mIRC DLL...', 'You are manually closing your DLL.', MB_OK);
1: messagebox(0, 'Unloading mIRC DLL...', 'Your DLL has timedout after 10 minutes.', MB_OK);
end;
end;
function ETA( mWnd: hWnd; aWnd: hWnd; Data: PChar; Parms: PChar;
Show: Boolean; NoPause: Boolean ): Integer; export; stdcall;
begin
strcopy(data, 'The search for E.T. will never end!');
result := 3;
end;
function ETB( mWnd: hWnd; aWnd: hWnd; Data: PChar; Parms: PChar;
Show: Boolean; NoPause: Boolean ): Integer; export; stdcall;
begin
strcopy(data, '/echo The search for E.T. will never end!');
strcopy(parms, '-a');
result := 2;
end;
function MsgBox( mWnd: hWnd; aWnd: hWnd; Data: PChar; Parms: PChar;
Show: Boolean; NoPause: Boolean ): Integer; export; stdcall;
begin
if NOT NoPause then
MessageBox(mWnd, data, 'mIRC', MB_OK);
result := 0;
end;
exports
LoadDll,
UnloadDll,
ETA,
ETB,
MsgBox;
begin
end.
Danke im Vorraus..