🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1463

Re: priority

#1463
From: Dennis Jones
Date: Mon, 06 Aug 2007 17:14
39 lines
1945 bytes
"mk" <mkreuter@kmccontrols.com> wrote in message 
news:46b74f74$1@newsgroups.borland.com...
>
> "Dennis Jones" <nospam@nospam.com> wrote:
>>
>>"mk" <mkreuter@kmccontrols.com> wrote in message
>>news:46b73889$1@newsgroups.borland.com...
>>>
>>> How to set an application's priority level?
>>
>>See:
>>
>>SetPriorityClass and SetThreadPriority.
>>
>>- Dennis
>>
>>
>
> This code does not error out but Task Manager does not show the priority 
> as high ....
>
> if ( !SetThreadPriority( GetCurrentThread(),    THREAD_PRIORITY_HIGHEST ))
> {
>   result = GetLastError();
>   sprintf( buffer, "Error [%d]", result );
>   Application->MessageBox( buffer, APP_TITLE, MB_OK );
> }

That's because the Task Manager shows the application's priority class, not 
thread priority.


> if I use Application->Handle, it errors out and reports a bad handle ...

That's because SetThreadPriority taks a thread handle, not an application 
handle.  SetPriorityClass is the one that takes an application handle.

- Dennis 
Technical Details
Message-ID: <46b7570c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46b73889$1@newsgroups.borland.com> <46b7478c$1@newsgroups.borland.com> <46b74f74$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d3a0c32a860a203e
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Dennis Jones" <nospam@nospam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <46b73889$1@newsgroups.borland.com> <46b7478c$1@newsgroups.borland.com> <46b74f74$1@newsgroups.borland.com>
Subject: Re: priority
Date: Mon, 6 Aug 2007 10:14:54 -0700
Lines: 41
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 71.245.109.58
Message-ID: <46b7570c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1186420492 71.245.109.58 (6 Aug 2007 10:14:52 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail