🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
8 messages
8 total messages Started by mauro Sat, 26 May 2007 11:32
Main Thread ID
#1850
Author: mauro
Date: Sat, 26 May 2007 11:32
6 lines
1063 bytes
Dear,

how to obtain the Id of the Main Thread?

Best Regards,
Mauro. 
Re: Main Thread ID
#1851
Author: mauro
Date: Sat, 26 May 2007 11:36
20 lines
1327 bytes
I remember there was an API like

CurrenThreadIsMainThread,
but I cannot remember the correct name (or maybe may memory is wrong).

Someone knows the solution?

thanks,
Mauro.


"mauro" <m.russo@uniplan.it> ha scritto nel messaggio 
news:46581ab4$1@newsgroups.borland.com...
> Dear,
>
> how to obtain the Id of the Main Thread?
>
> Best Regards,
> Mauro.
> 
Re: Main Thread ID
#1855
Author: Bob Gonder
Date: Sun, 27 May 2007 03:11
7 lines
997 bytes
mauro wrote:

>how to obtain the Id of the Main Thread?

"obtain" == "Get"

GetCurrentProcessId
Re: Main Thread ID
#1856
Author: Remy Lebeau (TeamB)
Date: Sun, 27 May 2007 18:56
14 lines
1170 bytes
"mauro" <m.russo@uniplan.it> wrote in message
news:46581ab4$1@newsgroups.borland.com...

> how to obtain the Id of the Main Thread?

The VCL has a global MainThreadID variable for that.

If you want to obtain the ID manually, then you have to call
GetCurrentThreadId() in the context of the main thread, such as during
program startup.


Gambit
Re: Main Thread ID
#1857
Author: Remy Lebeau (TeamB)
Date: Sun, 27 May 2007 18:56
10 lines
1062 bytes
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:3kth53dha9n7pdd7atcqn91sqmkhk57isi@4ax.com...

> GetCurrentProcessId

That returns the "process" ID, not the "thread" ID.


Gambit
Re: Main Thread ID
#1861
Author: mauro
Date: Mon, 28 May 2007 09:14
26 lines
1543 bytes
Yes, I need MainThradID.

I knew already GetcurrentThreadId().

Thanks,
Mauro.


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> ha scritto nel messaggio 
news:4659d495@newsgroups.borland.com...
>
> "mauro" <m.russo@uniplan.it> wrote in message
> news:46581ab4$1@newsgroups.borland.com...
>
>> how to obtain the Id of the Main Thread?
>
> The VCL has a global MainThreadID variable for that.
>
> If you want to obtain the ID manually, then you have to call
> GetCurrentThreadId() in the context of the main thread, such as during
> program startup.
>
>
> Gambit
>
> 
Re: Main Thread ID
#1874
Author: Remy Lebeau (TeamB)
Date: Mon, 28 May 2007 21:35
16 lines
1356 bytes
"mauro" <m.russo@uniplan.it> wrote in message
news:465a9d6b@newsgroups.borland.com...

> Yes, I need MainThradID.

So what's the problem then?  Like I said earlier, MainThreadID is a
global variable that is defined by the VCL.  Simply use it as-is, for
example:

    #include <System.hpp>

    ::PostThreadMessage(MainThreadID, WM_SOME_MSG, 0, 0);


Gambit
Re: Main Thread ID
#1876
Author: mauro
Date: Mon, 28 May 2007 23:24
37 lines
1980 bytes
Oh no, no problem.

I wrote "I need MainThreadID" to confirm you that it was the answer that I 
need :)

Moreover I knew already GetCurrentThreadId(), and this is because I looked 
for
a similar GetCurrentMainThreadId, but you told me it does not exists.
I justed want to write a condition to know id the current thread is the main 
thread
and now I will use
(GetCurrentThreadId() == MainThreadID)

Thanks again,
Mauro.


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> ha scritto nel messaggio 
news:465b4b6e$1@newsgroups.borland.com...
>
> "mauro" <m.russo@uniplan.it> wrote in message
> news:465a9d6b@newsgroups.borland.com...
>
>> Yes, I need MainThradID.
>
> So what's the problem then?  Like I said earlier, MainThreadID is a
> global variable that is defined by the VCL.  Simply use it as-is, for
> example:
>
>    #include <System.hpp>
>
>    ::PostThreadMessage(MainThreadID, WM_SOME_MSG, 0, 0);
>
>
> Gambit
>
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads