Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Windows API: Using CreateThread to create threads in Clarion 2002-04-04 -- Andrea Rodella Newsgroups: comp.lang.clarion
...hi all, the trick is teh PASCAL attribute on the called procedure
!!!
so the code is as follow :
!* Prototype *
CreateThread(<*GROUP>,ULONG,ULONG,ULONG,ULONG,*ULONG),UNSIGNED,RAW,DLL,PASCAL
!* My procedure*
prcsocket (long lpgroup),PASCAL
!* declarations *
mygrouptopasstype group,type
field1 cstring(20)
field2 long
end
mygrouptopass like(mygrouptopasstype)
!* calling Source code *
mygrouptopass.field1=GLO:Client_SocketX
mygrouptopass.field2=1
ThreadHandle = CreateThread( , 0, Address(prcsocket),
Address(mygrouptopass), 0,ThreadID)
!* called procedure *
prcsocket Procedure(long lpgroup)
localgroup like(mygrouptopass)
CODE
message(lpgroup) !That's ZERO !
! and if I try to access the memory with this parameter
memcpy(address(localgroup), lpgroup,size(mygrouptopasstype))
message(localgroup.field1)
On Wed, 03 Apr 2002 13:29:34 GMT, geasoft@eudora%$%mail.com (Andrea
Rodella) wrote:
>Hi Andrew,
>you confirm that with this prototyping
>> CreateThread(long lpSecurityAttributes, long Stacksize, long lpFunction, long lpParameter, |
>> long CreationFlags, *long ThreadID),long,raw,pascal
>> TerminateThread(long hThread, long dwExitCode),bool,pascal,proc
>you are able to pass parameters to the procedure you call with the
>CreateThread?
>
>If yes, please can you send me an extract of your code, to understand
>if it's a problem of my application or of my machine ?? (maybe is
>Win2K that works in a different way ?)
>
>Thanx a lot
>
>Bye
>
>
>
>
>On Tue, 2 Apr 2002 09:51:13 -0500, "Andrew Ireland"
>
Today is November 21, 2024, 7:11 am This article has been viewed 35207 times. Google search has resulted in 133 hits on this article since January 25, 2004.
|
|