hi, i want to make a dlg function as a childprocess.
I want to reate 5 in a row, but i dont know how to manage that with the handels.
is there a way to create a differen handle at runtime?
So i dont need to predefine the handels. - looks a little bit uncool!
Posted on 2003-05-31 02:36:10 by Forginforcer
You can't predefine any handles, they are provided by Windows at runtime.
Posted on 2003-05-31 02:43:03 by donkey
i mean a handle for the createthread function....
Posted on 2003-05-31 02:45:11 by Forginforcer

You can't predefine any handles, they are provided by Windows at runtime.
Posted on 2003-05-31 02:47:12 by donkey
donkey is right, handles is only and only provided by windows.


is there a way to create a differen handle at runtime?


just call the createthread and you'll got a new one .
Posted on 2003-05-31 03:12:36 by dion
I mean something else.

when you invoke createthread you to specify a parameter. - A DWORD variable.
Such a variable i want to ceate.
wehen i set the parameter NULL, ist crashs after severel invokes. (loop)
Posted on 2003-05-31 03:18:00 by Forginforcer
sorry dont get it. but i dont remember the params exactly. the amount of handles is not unlimited of course, but the number is big enough.

please describe more specific what you mean. you want to create a var? just create one then, whats the problem?
Posted on 2003-05-31 03:23:12 by dion
Hi, i mean this:

invoke CreateThread, 0, 0, OFFSET CheckPort, addr SPTS_temp, 0, NULL

the handle for the CT is NULL, that cused errors when i call this severel times.
Posted on 2003-05-31 03:30:43 by Forginforcer
If the handle you get back in eax is null, that means that thread creation failed. Call GetLastError to find out why.

My guess is it's because you're passing NULL to the lpThreadId parameter. That parameter can't be null in Win95/98/ME.
Posted on 2003-05-31 04:38:05 by iblis
thanks for the information.

look, when i use for every call a individual handle, the programm will not crasj probably.
I call it from a loop, how I should solve this problem?

I need a dynamic variable.
Posted on 2003-05-31 04:42:25 by Forginforcer
You need to brush up on your communication skills because I've read your posts over and over again and I still haven't a clue what you're trying to ask. And from the looks of it, neither does anybody else.
Posted on 2003-05-31 04:56:16 by iblis
Hm, thats stranges ?
what <ou do not understand "iblis" ?

I have a loop wich calls CreateThread every time.
CreateThread nees a parameter - a handle.
When I use the same handle - keep in mind, I've a loop - the Programm crashes.
So I have to use different handels.
But I cant - in the case, that the loop runs more then 5 times - define thousands of variables.
So I need a hardcore programming ideo to make it dynamically or so.
I'm at the end of my knoledge - what's not a miracle !:confused:

Do you know what I mean?

I would be habby, when someone correct this post.

Bye !
Posted on 2003-05-31 05:07:19 by Forginforcer
MSDN info for CreateThread:


Parameters
lpThreadAttributes
[in] Pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. If lpThreadAttributes is NULL, the handle cannot be inherited.
Windows NT/2000 or later: The lpSecurityDescriptor member of the structure specifies a security descriptor for the new thread. If lpThreadAttributes is NULL, the thread gets a default security descriptor.

dwStackSize
[in] Specifies the initial commit size of the stack, in bytes. The system rounds this value to the nearest page. For more information, see Thread Stack Size.
lpStartAddress
[in] Pointer to the application-defined function of type LPTHREAD_START_ROUTINE to be executed by the thread and represents the starting address of the thread. For more information on the thread function, see ThreadProc.
lpParameter
[in] Specifies a single parameter value passed to the thread.
dwCreationFlags
[in] Specifies additional flags that control the creation of the thread. If the CREATE_SUSPENDED flag is specified, the thread is created in a suspended state, and will not run until the ResumeThread function is called. If this value is zero, the thread runs immediately after creation. At this time, no other values are supported.
lpThreadId
[out] Pointer to a variable that receives the thread identifier.
Windows NT/2000 or later: If this parameter is NULL, the thread identifier is not returned.

Windows 95/98/Me: This parameter may not be NULL.

Do you notice that little Pointer... line after lpThreadId.. ? It means that this parameter is FILLED with the info it does not take INN a threadid, it GIVES you one.
Posted on 2003-05-31 05:18:07 by SFP
i do not acutal know, what you mean.
I need diferent pointers.
I dont want to use pre-defined ones.
Posted on 2003-05-31 05:48:14 by Forginforcer
He meant that the you can use the same pointer for the CreateThread.
Anyway it owuld be better for you to post some codes, so that we have some idea of what you are doing.
Posted on 2003-05-31 05:50:41 by roticv
oh so the rabbit jolts !

So me code have to be shit. FIrst I well see what I might loocked over.
I dont want to burdening you !
Posted on 2003-05-31 05:59:20 by Forginforcer
You have overlooked the basic understanding of parameters for API calls..... Generally parameters that are either inn or out (taken or filled).
Posted on 2003-05-31 07:02:40 by SFP
Hmm do someone have another Thread tutorial for me?

It seems that I have some peobs!
Posted on 2003-05-31 11:29:22 by Forginforcer
One thing i not realy understand:

When I create a thread, how i can overgive the handle to the thread, that i can use EcitThread.
I have the problem, that i have a loop wich calls every time the function.
Posted on 2003-05-31 11:38:17 by Forginforcer
hi Forginforcer, just taken easy :grin:
no offence please :)
we are all here just want to help you, if we dont, then we wont post anything, right?

i think you should take into account what the others said, like do your param is really true and valid. next, your way to use loop to call createthread is a bad practice, indeed, and it should not be the way like that. because each time its called, it asking windows to provide you one. except you can save each handle to a big array and you dont mess up with this storage, and... you dont overlimit the number you requested, it would be okay. an example that someone would think to do like you do is... what in this board, making an internet downloader, which is each time it create a new download thread, it need a new one. a newbie like me will use your way to achieve this goals. but, its not a good one tho. i remember this one because i was want to fix it with other way .
Posted on 2003-06-02 05:55:46 by dion