Using Win32 functions in Visual FoxPro Image Gallery
Shell Functions
..msdn
AssocQueryString
DllGetVersion
DragAcceptFiles
DragFinish
DragQueryFile
DragQueryPoint
FileIconInit
FindExecutable
GetFileNameFromBrowse
GetMenuContextHelpId
GetWindowContextHelpId
InetIsOffline
IsUserAnAdmin
LoadUserProfile
PathMakeUniqueName
PathYetAnotherMakeUniqueName
RealDriveType
RestartDialog
SHAddToRecentDocs
SHBrowseForFolder
SHCreateDirectory
ShellAbout
ShellExecute
ShellExecuteEx
Shell_GetImageLists
Shell_NotifyIcon
SHEmptyRecycleBin
SHFileOperation
SHFormatDrive
SHGetFileInfo
SHGetFolderPath
SHGetPathFromIDList
SHGetSpecialFolderLocation
SHGetStockIconInfo
SHParseDisplayName
SHQueryRecycleBin
SHSimpleIDListFromPath
UnloadUserProfile
WinHelp
Code examples:
Accessing Adobe Reader 7.0 main menu from VFP application
Accessing examples contained in this reference from a VFP application
Accessing examples contained in this reference through Web Services
Accessing Windows Control Panel from VFP Application
GDI+: converting text strings to images and saving in a graphics file
GDI+: creating a gradient
GDI+: creating scaled copy of image file
GDI+: cropping images
GDI+: Drawing a Pie Chart
How to access a file using not its name but an alias (hard link)
How to control Adobe Reader 9.0 (SDI mode) from VFP application
How to display Windows On-Screen Keyboard
Mapping and disconnecting network drives
Reading the structure of VFP main menu
Saving local machine ODBC Registry Entries to XML file
Storing content of the Clipboard to a bitmap file
Using Shell for performing operations on files
GDI+: creating a gradient

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
Before you begin:

The code is based on custom GDI+ class. Download the class module first and save it in gdiplus.prg file.
SET PROCEDURE TO gdiplus ADDITIVE
DO declare

PRIVATE gdiplus as gdiplusinit
gdiplus = CREATEOBJECT("gdiplusinit")

LOCAL oBitmap as gdibitmap
cFilename = "gradientsample.png"
nImgWidth = 300
nImgHeight = 300

oBitmap = CREATEOBJECT("gdibitmap",;
    nImgWidth, nImgHeight)

WITH oBitmap
    .graphics.FillRectangle(;
            ARGB(255,255,255, 255),;
            0,;
            0,;
            .imgwidth,;
            .imgheight)
ENDWITH

nPointCount = 128
nRadius = 120
cPoints = GeneratesCirclePoints(;
    nImgWidth/2,;
    nImgHeight/2,;
    nRadius,;
    nPointCount)

hBrush = 0
GdipCreatePathGradientI(;
    @cPoints, nPointCount, 4, @hBrush)

IF hBrush <> 0
    nColor1 = ARGB(0,156,0, 255)
    nColor2 = ARGB(230,255,230, 64)

    GdipSetPathGradientCenterColor(hBrush, nColor1)

    cColors = num2dword(nColor2)
    nColorCount = 1
    GdipSetPathGradientSurroundColorsWithCount(;
        hBrush, @cColors, @nColorCount)

    cPoints = num2dword(130) +;
        num2dword(140)

    GdipSetPathGradientCenterPointI(;
        hBrush, @cPoints)

    GdipFillRectangle(;
        oBitmap.graphics.graphics, hBrush,;
        0, 0, nImgWidth, nImgHeight)

    GdipDeleteBrush(hBrush)
ENDIF

oBitmap.SaveToFile(cFilename)
ShellExecute(0, "open", cFilename, "", "", 3)

oBitmap=NULL
gdiplus=NULL
* end of main

PROCEDURE GeneratesCirclePoints(;
    nAxisX, nAxisY, nRadius, nPointCount)
* generates a series of points forming a circle
    LOCAL nStep, nAngle, cResult
    nStep = (2 * PI()) / nPointCount

    cResult = ""
    FOR nAngle = 0 TO (2 * PI()) STEP nStep
        cResult = cResult +;
            num2dword(nAxisX + nRadius * COS(nAngle)) +;
            num2dword(nAxisY + nRadius * SIN(nAngle))
    NEXT
RETURN cResult

PROCEDURE declare
    DECLARE INTEGER ShellExecute IN shell32; 
        INTEGER hWindow, STRING lpOperation,; 
        STRING lpFile, STRING lpParameters,;  
        STRING lpDirectory, INTEGER nShowCmd

    DECLARE INTEGER GdipCreatePathGradientI IN gdiplus;
        STRING @points, INTEGER pointcount,;
        INTEGER wrapMode, INTEGER @polyGradient

    DECLARE INTEGER GdipSetPathGradientCenterColor IN gdiplus;
        INTEGER brush, INTEGER colors

    DECLARE INTEGER GdipSetPathGradientSurroundColorsWithCount;
    IN gdiplus;
        INTEGER brush, STRING @argbColor, INTEGER @colorcount

    DECLARE INTEGER GdipSetPathGradientCenterPointI IN gdiplus;
        INTEGER brush, STRING @points

    DECLARE INTEGER GdipGetPathGradientCenterPointI IN gdiplus;
        INTEGER brush, STRING @points

FUNCTION num2dword(lnValue)
#DEFINE m0 0x0000100
#DEFINE m1 0x0010000
#DEFINE m2 0x1000000
    IF lnValue < 0
        lnValue = 0x100000000 + lnValue
    ENDIF
    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)

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
2754 bytes  
Created: 2013-12-02 11:44:22  
Modified: 2013-12-02 11:56:34  
Visits in 7 days: 154  
Listed functions:
GdipCreatePathGradientI
GdipSetPathGradientCenterColor
GdipSetPathGradientCenterPointI
ShellExecute
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-2018 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.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.82.78.213)
7 sec.
17 sec.Function: 'CopyImage'
Function group: 'Resource'
24 sec.Function: 'GlobalSize'
33 sec.Example: 'How to print FoxPro form -- II'
43 sec.Function: 'SCardListInterfaces'
Function group: 'Authentication'
51 sec.Function: 'CeSetFilePointer'
Function group: 'Remote Application Programming (RAPI)'
58 sec.Function: 'SHEmptyRecycleBin'
Function group: 'Shell Functions'
1.1 min.Function: 'OpenService'
1.27 min.Updates
1.43 min.Function: 'DragQueryFile'
Function group: 'Shell Functions'
Google
Advertise here!