Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Accessing examples contained in this reference from a VFP application
Adding an ODBC data source with the SQLConfigDataSource; use automatic or interactive mode
Displaying animated images on FoxPro form with BitBlt and StretchBlt functions
Dragging files from Explorer window and dropping them on FoxPro control (requires VFP9)
Encapsulating access to the Windows Services in a class
How to position the GETPRINTER() dialog
Retrieving the names of all sections in an initialization file
Running a regular FoxPro form while main VFP window is minimized
Setting the date and time that a file was created
Simple printer queue monitor: deletes, pauses, resumes print jobs for local printer
Browsing Windows Known Folders (Special Folders)
Obtaining list of tables stored in an ODBC Data Source
How to view icons stored in executable files (Icon Viewer)
Smart Card Database Query Functions
Using NetWkstaTransportEnum to obtain MAC Address of remote server
Pocket PC: custom RAPI class for operating with files and folders on mobile device
Printf-style formatted text output in VFP
Displaying OS Memory Status
Enumerating print jobs and retrieving information for default printer (JOB_INFO_1 structures)
Extended OS Version info
How to obtain Content-Type value for a file type from the System Registry
How to register custom Event Log source
How to retrieve the number of print jobs queued for the printer
Retrieving names for the registered clipboard formats
Using GetNearestColor

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
 
DO decl
 
    * defining a device context for the VFP Main window
    hWnd = GetActiveWindow () 
    hDc = GetDC (hWnd)
 
    crColor = RGB (16, 108, 231)
    matchColor = GetNearestColor (hDc, crColor)
    ? LTRIM(STR(crColor)) + " transformed to " + LTRIM(STR(matchColor))
 
    = ReleaseDC (hwnd, hdc)
 
PROCEDURE  decl
    DECLARE INTEGER GetDC IN user32 INTEGER hwnd 
    DECLARE INTEGER GetActiveWindow IN user32 
 
    DECLARE INTEGER ReleaseDC IN user32;
        INTEGER hwnd, INTEGER hdc 
 
    DECLARE INTEGER GetNearestColor IN gdi32;
        INTEGER hdc,;
        INTEGER crColor
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
569 bytes  
Created: 2001-07-15 12:00:00  
Modified: 2001-09-28 16:45:16  
Visits in 7 days: 86  
Listed functions:
GetActiveWindow
GetDC
GetNearestColor
ReleaseDC
Printer friendly API declarations
My comment:
I ran this code with two color resolutions.

With 32-bit True Color the result was:
15166480 to 15166480

With 256 colors it was:
15166480 to 8421376
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.


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 (67.202.9.192)
3 sec.Function: 'GetWindowsDirectory'
6 sec.Function: 'NetServerEnum'
1.82 hrs.Example: 'CryptoAPI: Collection of Providers class'
1.83 hrs.Function: 'WTSRegisterSessionNotification'
Function group: 'Terminal Services'
1.93 hrs.Example: 'Winsock: how to retrieve the protocol information corresponding to a protocol name'
 Function: 'CeGlobalMemoryStatus'
Function group: 'Remote Application Programming (RAPI)'
3.07 hrs.Example: 'Retrieving Printer Device Context using PrintDlg function'
 Function: 'GdipBitmapSetPixel'
 Function: 'RegCreateKeyEx'
4.95 hrs.Example: 'Reading the state of mouse buttons within DO WHILE loop'
Google
Advertise here!