Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Drawing a window caption using the DrawCaption routine
How to delete a service object
Quering waveform-audio output devices
Retrieving national language settings
Retrieving the command line for the VFP session
Winsock: initializing the service in the VFP application
Comparing dimensions of the VFP main window with _SCREEN properties
Drawing standard Windows icons
Enumerating network interfaces on the local computer
GetFocus returns a HWND value
Obtaining the bounding rectangle for the specified device context
Reading current hardware profile
Retrieving a handle to DLL and address of an exported function in it
Using GetBinaryType (WinNT only) to determine the type of an executable file
Displaying the drive type value
Retrieving information specific to the current Time Zone
Dial the Net Automatically
Listing device drivers in the system: load addresses, names
Obtaining some properties for the Windows desktop using the GetWindowPlacement function
Get the power status of your laptop computer
Retrieveing information about the active window (even if it is not owned by the calling process)
Testing Clipboard functions: emptying the clipboard
Converting a hexadecimal string to an integer
Obtaining I/O counts for the current process
Drawing a window caption using the DrawCaption routine

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

#DEFINE DC_ACTIVE    1
#DEFINE DC_SMALLCAP  2
#DEFINE DC_ICON      4
#DEFINE DC_TEXT      8
#DEFINE DC_INBUTTON 16
#DEFINE DC_GRADIENT 32

LOCAL hWindowSrc, hWindowTrg, hDC

* the caption of this window is to be drawn
* actually you can supply a handle for any other window
hWindowSrc = GetActiveWindow()

* the target device context - to draw the caption on
hWindowTrg = GetFocus()
hDC = GetWindowDC(hWindowTrg)

* drawing the caption of the source window
* each time with different options

= DrawCaption(hWindowTrg, hDC,;
    GetRect(100, 200, 400, 220), DC_ICON+DC_TEXT)

= DrawCaption(hWindowTrg, hDC,;
    GetRect(100, 222, 400, 242), DC_ACTIVE+DC_ICON+DC_TEXT)

* releasing the target device context
= ReleaseDC(hWindowTrg, hDC)
* end of main

FUNCTION  GetRect (lnLeft, lnTop, lnRight, lnBottom)
* returns the RECT structure (four DWORDs) filled with the values
RETURN num2dword(lnLeft) + num2dword(lnTop) +;
    num2dword(lnRight) + num2dword(lnBottom)

FUNCTION  num2dword (lnValue) 
#DEFINE m0       256
#DEFINE m1     65536
#DEFINE m2  16777216
    LOCAL b0, b1, b2, b3
    b3 = Int(lnValue/m2)
    b2 = Int((lnValue - b3 * m2)/m1)
    b1 = Int((lnValue - b3*m2 - b2*m1)/m0)
    b0 = Mod(lnValue, m0)
RETURN Chr(b0)+Chr(b1)+Chr(b2)+Chr(b3)

PROCEDURE  decl
    DECLARE INTEGER GetActiveWindow IN user32
    DECLARE INTEGER GetFocus IN user32
    DECLARE INTEGER GetWindowDC IN user32 INTEGER hwnd
    DECLARE INTEGER ReleaseDC IN user32 INTEGER hwnd, INTEGER hdc

    DECLARE INTEGER DrawCaption IN user32;
        INTEGER hwnd, INTEGER hdc,;
        STRING lprc, INTEGER uFlags


User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1606 bytes  
Created: 2001-12-31 18:03:13  
Modified: 2001-12-31 18:03:58  
Visits in 7 days: 77  
Listed functions:
DrawCaption
GetActiveWindow
GetFocus
GetWindowDC
ReleaseDC
Printer friendly API declarations
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-2017 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.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.198.134.32)
11 sec.Function: 'mixerSetControlDetails'
Function group: 'Windows Multimedia'
21 sec.Example: 'Retrieving configuration information for the specified workstation (Win2000/XP)'
33 sec.Function: 'SQLConfigDataSource'
Function group: 'ODBC API'
43 sec.
Function group: 'String'
54 sec.Function: 'CeRapiInvoke'
Function group: 'Remote Application Programming (RAPI)'
1.08 min.
1.28 min.Function: 'waveOutGetPosition'
Function group: 'Windows Multimedia'
1.48 min.Function: 'FlushFileBuffers'
Function group: 'File Management'
1.72 min.Function: 'GetMonitorCapabilities'
Function group: 'Monitor Configuration (Vista)'
1.93 min.Function: 'SHGetSpecialFolderLocation'
Function group: 'Shell Functions'
Google
Advertise here!