Need a little help with Thread

delphi package - easy access to kernel objects etc.
Post Reply
Teerayoot
Posts: 10
Joined: Tue May 18, 2004 5:04 pm

Need a little help with Thread

Post by Teerayoot »

I want to create new windows in new thread .
This is my threadfunc.
UINT WINAPI ThreadFunc( LPVOID lpParam )
{

mainform = new TForm3(NULL);
mainform->Show();
Application->ProcessMessages() ;

delete mainform;

return 0;
}
And this in dll attach
if (fdwReason == DLL_PROCESS_ATTACH)
{
// InitializeMadCHook();
CollectHooks ();
HookAPI("WS2_32.DLL", "send", sendCallback, (PVOID)sendNext ,(unsigned)(0x0));
FlushHooks ();


Madkernel::NewThread(ThreadFunc)->WouldWait();

}
But when mainform->Show(); it show with a secound and destroy.:?
I want to a mainform process message as usual form ,help me please?



Thank in advance.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Please do not use VCL in a thread. And please do also not use VCL in a hook dll which you inject into more than one specific process. Use pure win32 APIs instead.

Your dll should not be bigger than 100-150kb. Otherwise you've probably linked the VCL in, which is a bad idea for hook dlls.
Post Reply