Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Enumerating data formats currently available on the clipboard
Adding and deleting Scheduled Tasks using NetScheduleJob API functions
Winsock: sending email messages (SMTP, port 25)
Mapping and disconnecting network drives
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Custom GDI+ class
Winsock: retrieving directory listing from an FTP server using passive data connection (FTP, port 21)
Converting Unicode data from the Clipboard to a character string using a given code page
Disk in drive A:
How to display the Properties dialog box for a file (ShellExecuteEx)
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
Enumerating network resources
Detecting changes in connections to removable drives (VFP9)
How to download a file from the FTP server using FtpGetFile
Using EnumPrinters function to enumerate locally installed printers
Splash Screen for the VFP application
How to play AVI file on the _screen
Retrieving the name of the network resource associated with a local device
Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)
Creating a console window for Visual FoxPro application
Custom HttpRequest class (WinHTTP)
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
Custom FTP Class for Visual FoxPro application
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: 70  
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 (54.234.42.16)
1.03 hrs.Example: 'Printing text on the client area of the main VFP window'
2.76 hrs.Example: 'GDI+: Creating thumbnails to preview images in a directory'
2.77 hrs.Function: 'JetCreateTable'
Function group: 'Extensible Storage Engine (ESE, Jet Blue)'
7.27 hrs.Function: 'if_nametoindex'
Function group: 'IP Helper'
 Function: 'DrawCaption'
Function group: 'Painting and Drawing'
10.17 hrs.Example: 'Using the MessageBox Win32 function'
 Function: 'midiOutClose'
Function group: 'Windows Multimedia'
11.1 hrs.Example: 'How to retrieve adapter information for the local computer (including MAC address)'
 Function: 'NetLocalGroupEnum'
Function group: 'Network Management'
15.66 hrs.Function: 'CryptProtectData'
Google
Advertise here!