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 !
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 !
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Whoo hoo!!
Does it work now (it does for me). You can accept my comment as the answer if it does.
ASKER
Thanks