To jest Kod Plugina do PowerGG!!
Po zainstalowaniu tego plugina dodaje się do menu PowerGG "Hello Delphi"...
Kiedy się kliknie na "Hello Delphi" pojawia się informacja "Hello user".
A jak zrobić żeby po kliknięciu na "Hello Delphi" pojawiała się wcześniej utworzona w tej bibliotece forma o nazwie "DLLForm" ??
library DHello;
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
uses Windows, PowerGG in '..\..\PowerGG.pas';
var
Username: string;
Thread: THandle;
const
{$IFDEF FPC}
Title = 'Hello FPC';
{$ELSE}
Title = 'Hello Delphi';
{$ENDIF}
function MenuProc(Status: UINT): UINT; stdcall; forward;
function ThreadProc(Param: Pointer): DWORD; stdcall;
begin
MessageBox(0, PChar('Hello ' + Username), Title, MB_OK);
MenuSet(MenuProc, MF_UNCHECKED);
CloseHandle(Thread);
Result := 0;
end;
function MenuProc(Status: UINT): UINT; stdcall;
var
ThreadId: DWORD;
begin
if Status = MF_CHECKED then begin
if TerminateThread(Thread, 0) then CloseHandle(Thread);
Result := MF_UNCHECKED;
end else begin
Thread := CreateThread(nil, 0, @ThreadProc, nil, 0, ThreadId);
Result := MF_CHECKED;
end;
end;
procedure ProfileProc(Profile: PChar); stdcall;
var
i: Integer;
begin
Username := Profile;
i := Length(Username);
if Username[i] = '\' then begin
SetLength(Username, i - 1);
Dec(i);
end;
while (i > 0) and (Username[i] <> '\') do Dec(i);
Delete(Username, 1, i);
end;
begin
if not InitPlug then Halt(1);
MenuInit(MenuProc, Title, MF_UNCHECKED);
OnProfileChange(ProfileProc);
DisableThreadLibraryCalls(HInstance);
end.