Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to find when the application started
How to retrieve adapter information for the local computer (including MAC address)
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Setting the date and time that a file was created
The window and its ancestors
How to display advanced Task Dialog (Vista)
How to display the port-configuration dialog box for a port on the specified server
Retrieving size of a remote file
System and Local Time values
Using vendor-neutral SQL constructs
Enumerating print processors and supporting data types installed on the specified server
Getting a bit more than the _CLIPTEXT offers
Opening the Page Setup dialog box to specify the attributes of a printed page
Quering Audio Mixer Device
Removing FTP directory
Using NetWkstaTransportEnum to obtain MAC Address of remote server
Winsock: reading and setting socket options
Displaying dimmed window behind VFP top-level form
GDI+: how to make VFP controls visually shake and shudder
GDI+: printing vertical text on VFP reports via generated images (VFP9)
How to position the GETPRINTER() dialog
Retrieving information about the main VFP window
Retrieving the name and type of all available RAS-capable devices
Changing file attributes
Converting twips to pixels and vice versa

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
 
#DEFINE LOGPIXELSX 88
#DEFINE LOGPIXELSY  90
#DEFINE TwipsPerInch 1440
 
DO declare
 
LOCAL hWindow, hdc, pixResX, pixResY
hWindow = 0
hdc = GetDC(m.hWindow)  && entire screen
 
? "*** Pixels per inch:"
pixResX = GetDeviceCaps(hdc, LOGPIXELSX)
pixResY = GetDeviceCaps(hdc, LOGPIXELSY)
? "Horizontal:", pixResX
? "Vertical:  ", pixResY
 
?
? "*** Twips per inch:", TwipsPerInch
 
?
? "*** 100 pixels are equivalent to:"
? "Horizontal:", TwipsPerInch * 100/pixResX, "pixels"
? "Vertical:  ", TwipsPerInch * 100/pixResY, "pixels"
 
?
? "*** 1000 twips are equivalent to:"
? "Horizontal:", 1000 * pixResX/TwipsPerInch, "twips"
? "Vertical:  ", 1000 * pixResY/TwipsPerInch, "twips"
 
= ReleaseDC(m.hWindow, m.hdc)
 
PROCEDURE declare
    DECLARE INTEGER GetDC IN user32 INTEGER hWindow
 
    DECLARE INTEGER ReleaseDC IN user32;
        INTEGER hWindow, INTEGER hdc
 
    DECLARE INTEGER GetDeviceCaps IN gdi32;
        INTEGER hdc, INTEGER nIndex
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
951 bytes  
Created: 2001-10-09 21:40:08  
Modified: 2007-07-27 17:14:25  
Visits in 7 days: 79  
Listed functions:
GetDC
GetDeviceCaps
ReleaseDC
Printer friendly API declarations
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
Willson | 2007-07-27 12:05:55
The line,

? "Vertical: ", 1000 * pixResX/TwipsPerInch, "twips"

I think should actually refer to pixRexY instead...
Willson | 2007-07-27 12:06:53
Er, make that "pixResY", too, not "pixRexY".
A.M. | 2007-07-27 17:10:56
Thanks for noticing! Fixed.

Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (50.16.17.90)
1.05 hrs.Function: 'ImageList_GetImageInfo'
Function group: 'Windows Controls'
 Example: 'Creating a folder'
2.19 hrs.Function: 'SQLManageDataSources'
 Example: 'Retrieving the name of the network resource associated with a local device'
4.82 hrs.Example: 'Displaying bitmap using the AlphaBlend function'
 Function: 'CreateService'
Function group: 'Service'
 Example: 'Listing device drivers in the system: load addresses, names'
5.03 hrs.Function: 'AVIStreamGetFrame'
 Function: 'DrawIcon'
13.12 hrs.Function: 'waveOutGetPosition'
Google
Advertise here!