code

Fit to Page in Excel and Word

File date and time

Code below shows how to retrieve file date and time using native VFP commands or WSH. For Windows API based solution that also allows to set file date and time, see George Tasker's Windows Time hosted on UT

MSDN links:

Enumerating Windows on Taskbar

Enumerating IE instances

The Windows Shell provides a powerful set of automation objects that enable you to access the file system, launch programs, and change system settings.

The Shell Windows Method creates and returns a ShellWindows object that represents a collection of all of the open windows that belong to the Shell, including Internet Explorer.

Enumerate Available Drives

The code below demonstrates the use of the DRIVETYPE() function.

Editable checkbox in a Grid with AllowCellSelection disabled

The GridHitTest method can be used to to determine where user clicked on the grid and update checkbox accordingly. Note that checkbox status can be changed by mouse only because there's no current cell when AllowCellSelection=.F.

Determine Printer Margins Programmatically

The GetDeviceCaps function can be used to retrieve printer-specific information as demonstrated below.

This is sample code. Add error handling and adjust to your requirements as necessary.

CLEAR
 
#DEFINE LOGPIXELSX    88    && Logical pixels/inch in X         
#DEFINE LOGPIXELSY    90    && Logical pixels/inch in Y         
 
#DEFINE PHYSICALWIDTH   110 && Physical Width in device units   
#DEFINE PHYSICALHEIGHT  111 && Physical Height in device units  
#DEFINE PHYSICALOFFSETX 112 && Physical Printable Area x margin 
Syndicate content