I have a VFP 8 EXE and I want the EXE to run with a lower process/thread
priority automatically.

How do I change the EXE process priority from within the running EXE?

M.

RE: Change process priority by Leemi

Leemi
Wed Feb 04 16:26:00 CST 2004

Hi Mark:

I am not sure if this will give you what you need, but I think it is start.
Take a look at the "Enumerate Processes in Windows" utility on
universalthread.com. Go to www.universalthread.com, click on the Download
icon, and choose Visual FoxPro as the product. In the ID text box of the
query page, search for "9651."

I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP8 HAS ARRIVED!! --*
Read about all the new features of VFP8 here:
http://www.universalthread.com/VisualFoxPro/News/VFP8Release.asp
Purchase VFP8 here:
http://shop.microsoft.com/Referral/Productinfo.asp?siteID=11518

Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retires Sept. 30th, 2003


>I have a VFP 8 EXE and I want the EXE to run with a lower process/thread
>priority automatically.

>How do I change the EXE process priority from within the running EXE?

>M.


Re: Change process priority by Mark

Mark
Wed Feb 04 16:47:54 CST 2004

Actually I eventually did find these two API functions:

DECLARE INTEGER SetPriorityClass IN Win32api INTEGER,INTEGER
DECLARE INTEGER SetThreadPriority IN Win32api INTEGER,INTEGER

I can't seem to get the EXE to show up as "BelowNormal" in the task manager.
I can get it to show up as "Low" by the following call:

#DEFINE NORMAL_PRIORITY_CLASS 32
#DEFINE IDLE_PRIORITY_CLASS 64
#DEFINE HIGH_PRIORITY_CLASS 128
#DEFINE REALTIME_PRIORITY_CLASS 256

DECLARE INTEGER SetPriorityClass IN Win32api INTEGER,INTEGER
Declare Long GetCurrentProcess In kernel32

SetPriorityClass(getcurrentprocess(), IDLE_PRIORITY_CLASS)


I see that there is a constant defined for a thread priority below normal
(THREAD_PRIORITY_BELOW_NORMAL -1), but using this does not change the
process to "BelowNormal".

I am missing something.....what?


--------

No matter what

"Lee Mitchell" <Leemi@online.microsoft.com> wrote in message
news:P%2337b226DHA.1992@cpmsftngxa07.phx.gbl...
> Hi Mark:
>
> I am not sure if this will give you what you need, but I think it is
start.
> Take a look at the "Enumerate Processes in Windows" utility on
> universalthread.com. Go to www.universalthread.com, click on the Download
> icon, and choose Visual FoxPro as the product. In the ID text box of the
> query page, search for "9651."
>
> I hope this helps.
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> Sincerely,
> Microsoft FoxPro Technical Support
> Lee Mitchell
>
> *-- VFP8 HAS ARRIVED!! --*
> Read about all the new features of VFP8 here:
> http://www.universalthread.com/VisualFoxPro/News/VFP8Release.asp
> Purchase VFP8 here:
> http://shop.microsoft.com/Referral/Productinfo.asp?siteID=11518
>
> Keep an eye on the product lifecycle for Visual FoxPro here:
> http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
> - VFP5 Mainstream Support retired June 30th, 2003
> - VFP6 Mainstream Support retires Sept. 30th, 2003
>
>
> >I have a VFP 8 EXE and I want the EXE to run with a lower process/thread
> >priority automatically.
>
> >How do I change the EXE process priority from within the running EXE?
>
> >M.
>



Re: Change process priority by Eric

Eric
Thu Feb 05 00:37:48 CST 2004

Hello, Mark!
You wrote on Wed, 04 Feb 2004 22:47:54 GMT:

MM> I can't seem to get the EXE to show up as "BelowNormal" in the task
MM> manager.

HOWTO: Modify the Process Priority of a Shelled Application
http://support.microsoft.com/default.aspx?scid=kb;en-us;193846

These are the PriorityClass values (source:
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/scrguide/sas_prc_dxpz.asp)
32 - Normal
64 - Low
128 - High
16384 - Below Normal
32768 - Above Normal

Good luck!
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Re: Change process priority by Mark

Mark
Thu Feb 05 09:34:31 CST 2004

That worked! Thanks. I could only find the Normal, Low, and High
constants. Now the Below Normal and Above Normal work.


"Eric den Doop" <ericdendoop@xspamblockxfoxite.com> wrote in message
news:ufRiTK76DHA.360@TK2MSFTNGP12.phx.gbl...
> Hello, Mark!
> You wrote on Wed, 04 Feb 2004 22:47:54 GMT:
>
> MM> I can't seem to get the EXE to show up as "BelowNormal" in the task
> MM> manager.
>
> HOWTO: Modify the Process Priority of a Shelled Application
> http://support.microsoft.com/default.aspx?scid=kb;en-us;193846
>
> These are the PriorityClass values (source:
>
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/scrguide/sas_prc_dxpz.asp)
> 32 - Normal
> 64 - Low
> 128 - High
> 16384 - Below Normal
> 32768 - Above Normal
>
> Good luck!
> --
> Eric den Doop
> www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8
>
>