library hstylus;

uses
  SysUtils,
  Classes,
  windows;

type
 TmIRCDLL = packed record
  mVersion : DWORD;
  mHwnd    : HWND;
  mKeep    : Boolean;
 end;
PmIRCDLL = ^TmIRCDLL;

function m_titlebar(mWnd: hWnd;aWnd: hWnd;Data: PChar;Parms: PChar;Show: Boolean;NoPause: Boolean): Integer;export;stdcall
begin
        setwindowtext(mWnd,data);
        result:= 3;
end;

function a_titlebar(mWnd: hWnd;aWnd: hWnd;Data: PChar;Parms: PChar;Show: Boolean;NoPause: Boolean): Integer;export;stdcall
begin
        setwindowtext(aWnd,data);
        result:= 3;
end;

function x_habilitar(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall;
begin
    EnableMenuItem(GetSystemMenu(StrToInt(data), False),SC_Close, MF_ByCommand or MF_Enabled);
    Result := 0;
end;

function x_desabilitar(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall;
begin
    EnableMenuItem(GetSystemMenu(StrToInt(data), False),SC_Close, MF_ByCommand or MF_Grayed);
    Result := 0;
end;

function e_cursor(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall;
begin
    showcursor(false);
    Result := 2;
end;

function m_cursor(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall;
begin
    showcursor(true);
    Result := 2;
end;

function statusbar(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall;
VAR
A,TEXTO:STRING;
    HJANELA:HWND;
BEGIN
    A:=STRING(DATA);
    HJANELA:=STRTOINT(COPY(A,1,POS(' ',A)-1));
    TEXTO:=COPY(A,POS(' ',A)+1,LENGTH(A));
    CreateWindow('msctls_statusbar32',PChar(TEXTO),WS_VISIBLE + WS_CHILD, 1, 2, 198, 155, HJANELA, 0, 0, nil);
    Result := 3;
end;
    
function progressbar(mWnd, aWnd: HWND; data, parms: PChar; show, nopause:boolean):integer; stdcall;
VAR
A,TEXTO:STRING;
    HJANELA:HWND;
BEGIN
    A:=STRING(DATA);
    HJANELA:=STRTOINT(COPY(A,1,POS(' ',A)-1));
    TEXTO:=COPY(A,POS(' ',A)+1,LENGTH(A));
    CreateWindow('msctls_progress32',PChar(TEXTO),WS_VISIBLE + WS_CHILD, 1, 2, 198, 155, HJANELA, 0, 0, nil);
    Result := 3;
end;

function info( mWnd: hWnd; aWnd: hWnd; Data: PChar; Parms: PChar;
Show: Boolean; NoPause: Boolean ): Integer; export; stdcall;
begin
 strcopy(data, '/echo -a BRstylus.dll por chrystoffer - Visite-nos na brasnet no canal #BRteam :)');
 result := 2;
end;

exports
progressbar, statusbar, m_titlebar, a_titlebar, x_habilitar, x_desabilitar, e_cursor, m_cursor, info;

begin
end.