Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Retrieving list of Global Atom names
Retrieving the names of all sections in an initialization file
Setting properties of the window: caption and user-defined value
Terminating all running applications from a VFP program
Using an Event Object. Part A: running an application that creates an Event object
Using the CreateFile
Animating a transition of the VFP form (a wire-frame rectangle)
Enumerating Processes -- WinNT
FindText -- the hopeless and useless Common Dialog
How to hide your program from the Close Program dialog (Win9* only)
How to intercept window messages sent to VFP form
How to print picture stored in enhanced-format metafile (*.emf)
Retrieving configuration information for the specified workstation (Win2000/XP)
Retrieving list of supported paper names (for example, Letter or Legal) for a given printer
Retrieving the state of your Internet connection
Using Beep and Sleep functions to make the old tin buzz sing (WinNT only?)
Enumerating Processes -- Win9*
Reading security permissions for NTFS files and folders
CryptoAPI: Collection of Providers class
Enhanced GetFont dialog
Obtaining a handle to the desktop associated with the calling thread
Retrieving information about the specified icon
String representation for disk or memory capacity
How to download a file from HTTP server using URL Monikers functions
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: 60  
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 (23.22.212.158)
2.76 hrs.Example: 'Displaying dimmed window behind VFP top-level form'
 Example: 'GDI+: Color Transparency'
 Solution: 'Extended MessageBox library (FLL) for Visual FoxPro'
4.25 hrs.Function: 'RegSetValueEx'
Function group: 'Registry'
 Example: 'GDI+ fun: roach-infested desktop'
5.43 hrs.Example: 'Reading entries from Event logs'
 Example: 'How to put a vertical text scrolling on the form (a movie cast)'
7.47 hrs.Function: 'RemoveDirectory'
Function group: 'File Management'
 Example: 'Winsock: how to retrieve a service information corresponding to a port'
 Example: 'How to display the Print property sheet'
Google
Advertise here!