Link to home
Start Free TrialLog in
Avatar of snoopy_Spy
snoopy_Spy

asked on

Problems with Thread

Hi i have a litle problem with my thread.
I want to give a parameter to the thread Procedure !

H:=1;
ComThread := CreateThread(nil, 16384, @ComThreadProc, Pointer(H), 0, ComThreadID);


procedure ComThreadProc(H : integer);
begin
    if H <> 1 then H := 1;
    with ComPorts[H] do

H is 0 in the Thread's procedure !
Avatar of snoop_doggy_dogg
snoop_doggy_dogg

Kinda gives me the willies...just tried it for myself...listening.
Try

ComThread := CreateThread(nil, 16384, @ComThreadProc, @H, 0, ComThreadID);

I think you should treat H in ComThreadProc as a pointer too....

Epsylon.
Ep, that's what I thought too...but the cast is done automatically.  It still wont work, I bet.
ASKER CERTIFIED SOLUTION
Avatar of Epsylon
Epsylon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Whoo hoo!!
Does it work now (it does for me). You can accept my comment as the answer if it does.
Avatar of snoopy_Spy

ASKER

Thanks