Lowering memory usage by application
The working set of a process is the set of memory pages currently visible to the process in physical RAM memory. These pages are resident and available for an application to use without triggering a page fault. While increasing your working set size can reduce paging for your application, it can adversely affect the system performance.
VFP is know in using all the memory it can get. One of proactive steps in reducing memory usage is limiting VFP buffers size using SYS(3050) - Set Buffer Memory Size. It's a good idea to empty the working set when your application goes into a wait state. It can be done by calling EmptyWorkingSet Function or SetProcessWorkingSetSize Function and uses GetCurrentProcess Function.
Retrieving Printer Capabilities
In Enumerating printer forms article the DeviceCapabilities
function is used to mark print forms supported by particular printer. It can be used to retrieve other printer capabilities as well.
Getting additional info about pressed keyboard or mouse keys
The GetKeyState
function retrieves the status of the specified virtual key.
Keyboard Input Virtual-Key Codes
Virtual-Key Codes constants for Windows API Keyboard Input functions
Add and delete custom printer forms
To distribute applications that use reports with custom paper size you have to create custom printer forms on every destination PC that runs Windows 2000 or later. The MS KB article Q157172
explains how it can be done manually. However there's a way to do that programmatically using Windows API.
Enumerating printer forms
Enumerating of printer forms can be done with Windows API EnumForms function. Contrary to what MSDN says, it returns the list of all printer forms on PC, not just for the specific printer. On other hand, DeviceCapabilities can return a list of supported paper sizes for the printer.
Get number of jobs in print queue
The number of jobs in print queue can be retrieved by simplified version of Enumerating jobs in print queue
Enumerating jobs in print queue
Enumerating jobs in a print queue can be done with
- WMI Win32_PrintJob class
- Windows API EnumJobs function.
How to delete all Print Jobs from a print queue
All jobs from a print queue can be deleted with
- WMI Win32_Printer class and CancelAllJobs method
- Windows API SetPrinter function.