Saturday, February 20, 2021

Announcing Virtual Fox Fest May 2021

We had so much fun at Virtual Fox Fest 2020 that we’ve decided to do more online conferences. They won’t all be three-day events; in fact, the next one (Thursday, May 6, 2021) is a one-day event. However, it’ll still have the same great features everyone loves about VFF: great speakers delivering great sessions, live chatting during presentations, and getting to hang out virtually with new and old friends. This event will feature classic sessions from Southwest Fox, updated for 2021. Registration is available now so sign up today!

We’re still discussing whether to hold Southwest Fox in Arizona this fall. We expect to announce our plans for a fall conference by the end of March.

Wednesday, January 20, 2021

Changing Execution Priority on Demand

Recently, a friend asked me if it was possible to change the execution priority for some tasks on the fly. The issue was that when a user on a terminal server runs a report in Stonefield Query, which can be computing intensive as it retrieves and massages the data required for the report, other users may experience slower response. I did some research and it turned out to be easy to do, thanks to Rick Strahl's wwDotNetBridge.

The following code changes the priority for the running application to BelowNormal (see the documentation for the System.Diagnostics.ProcessPriorityClass enum for the different priority levels):

do wwDotNetBridge
loBridge = GetwwDotNetBridge()
loProcess = loBridge.InvokeStaticMethod('System.Diagnostics.Process', 'GetCurrentProcess')
loProcess.PriorityClass = loBridge.GetEnumValue('System.Diagnostics.ProcessPriorityClass.BelowNormal')

(This assumes you have wwDotNetBridge.prg included in your project and wwDotNetBridge.dll and ClrHost.dll in the current folder or VFP path.)

Use this code just before some process you want to run at a lower priority. Use similar code but a different value, such as Normal, to set the priority back again after the process is done.

As I have said many times, there's almost nothing we can't do in VFP with wwDotNetBridge.