Co robię źle - wątki & plug do tlena ?!?

0

Co robię źle (nie uruchamia tego co jest w wątku)

Kod Plugina:

library Termometr_Tlen;

{$R *.res}

uses
Windows, Classes,
plugin_struct in 'plugin_struct.pas',
Pomiar_Unit in 'Pomiar_Unit.pas';

... (tu jest standard)

function LoadPlugin(functions: pTLENPLUGINFUNCTIONS): Integer; cdecl;
Var
Pomiar:TPomiar;

Begin
tlen_functions:=functions;
MessageBox(0, 'Plugin załadowany!', 'Radujmy się ;-)', MB_OK);

Pomiar:=TPomiar.Create(True);
Pomiar.resume;

Result:=0;
End;

exports
GetPluginInfo,
LoadPlugin,
UnloadPlugin;

begin
end.

KOD WĄTKU:

unit Pomiar_Unit;

interface

uses
Classes {$IFDEF MSWINDOWS} , Windows {$ENDIF}, SysUtils, Forms,
plugin_protocol_defs,
plugin_struct;

type
TPomiar = class(TThread)
private
protected
procedure Execute; override;
end;

Var
tlen_functions: pTLENPLUGINFUNCTIONS;
ppd: ProtocolPresenceDef;

implementation

function CallTlenProtoFunction(hinst: HINST; a: PChar; b: PChar; c: WPARAM; d: LPARAM): Integer;
var
fn: ProtocolFunctionDef;
begin
FillChar(fn, sizeof(fn), 0);
fn.structSize:=sizeof(fn);
fn.ProtocolID:=a;
fn.FunctionName:=b;
fn.wParam:=c;
fn.lParam:=d;
result:=tlen_functions.CallTlenFunction(hinst, TLEN_PROTOCOL_CALL_FUNCTION, WPARAM(@fn), 0);
end;

procedure TPomiar.Execute;
var
i:integer;
s:string;
start: dword;

begin
FreeOnTerminate:=True;
While Not (Application.Terminated) or (Terminated) do
begin

for i:=0 to 100 do
begin
s:='Test-> '+inttostr(i);

FillChar(ppd, SizeOf(ppd), 0);
ppd.structSize := SizeOf(ppd);
ppd.CurrentState := PROTOCOL_PRESENCE_STATE_INVISIBLE;
ppd.CurrentDescription:=pchar(s);
CallTlenProtoFunction(hInstance,'TLEN','PFChangeUserState',WPARAM(@ppd),0);

start:=GetTickCount;
While GetTickCount<(start+100) do
Begin
Sleep(20);
Application.ProcessMessages;
end;
end;
end;

end;

end.

0
Xaveri napisał(a)

Niech administrator da możliwość wrzucania plików na forum będzie łatwiej żyć !

od tego jest rapidshare.de i podobne

a jakbyś kod dał w znaczniki < delphi> to by prościej było (i sformatował go jakoś)

1 użytkowników online, w tym zalogowanych: 0, gości: 1