Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Delphi] Multi-Threading

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
GuM
Expert Cheater
Reputation: 0

Joined: 17 Jan 2007
Posts: 185
Location: The Netherlands

PostPosted: Wed Dec 26, 2007 10:56 am    Post subject: [Delphi] Multi-Threading Reply with quote

Could anyone explain to me how I can create threads in Delphi? I've looked at some tutorials but I still don't understand it. I want to make a program that sends messages to a Memobox, but doesn't lock up while doing that.

Thanks.
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Wed Dec 26, 2007 12:34 pm    Post subject: Reply with quote

Look at this code:
By Google Lab
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 474

Joined: 09 May 2003
Posts: 25957
Location: The netherlands

PostPosted: Wed Dec 26, 2007 1:29 pm    Post subject: Reply with quote

you could of course do the windows api method:
define a function like:

function mythread(parmeter: pointer); stdcall;
begin
//your threadcode
end;

...
...
var tid: dword;
begin
createthread(nil,0, @mythread, nil, 0, tid);
..
..


OR use a object oriented method using the TThread class (my prefered method)
type tmythread=class(tthread)
public
procedure execute; override;
end;

procedure tmythread.execute;
begin
//do your thread stuff here

end;

...
tmythread.create(false);

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
rapion124
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Mar 2007
Posts: 1095

PostPosted: Wed Dec 26, 2007 2:15 pm    Post subject: Reply with quote

Using the TThread class is the easiest way because you can control your thread very easily without using Win32 APIs.
Back to top
View user's profile Send private message
GuM
Expert Cheater
Reputation: 0

Joined: 17 Jan 2007
Posts: 185
Location: The Netherlands

PostPosted: Thu Dec 27, 2007 9:46 am    Post subject: Reply with quote

Okey, but how do I run the Thread? When I do "TMyThread.Create(False);" it gives me an error. "TMyThread.Resume;" also gives me an error.
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Thu Dec 27, 2007 9:59 am    Post subject: Reply with quote

TMyThread.execute;
Back to top
View user's profile Send private message
rapion124
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Mar 2007
Posts: 1095

PostPosted: Thu Dec 27, 2007 12:10 pm    Post subject: Reply with quote

Post your source. TMyThread.Create(False) should work. If your thread is in another source file, you should add that source file to the implementation uses list of your main program.

What does the error say? Is it a compiler error or runtime error?
Back to top
View user's profile Send private message
GuM
Expert Cheater
Reputation: 0

Joined: 17 Jan 2007
Posts: 185
Location: The Netherlands

PostPosted: Thu Dec 27, 2007 2:32 pm    Post subject: Reply with quote

Oh nvm. It already works.
Thanks Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites