Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Enumerating the subkeys for a given registry key
How to view system icons for the classes installed on the local machine
Obtaining heap handles and enumerating memory blocks for the current VFP session (WinNT only)
Reading current hardware profile
Reading data from INI files
Retrieving Printer Device Context using PrintDlg function
System Image List Viewer
Enumerating Processes -- WinNT
How to start the screen saver and how to find whether the screen saver is active
Retrieving geometrical parameters of the system desktop window
Uploading file to the FTP server using InternetWriteFile
Who owns the Windows Clipboard
Deleting a file stored on the FTP server
GDI+: printing vertical text on VFP reports via generated images (VFP8)
How to display a Task Dialog (Vista)
Pocket PC: enumerating mounted database volumes and databases in the Object Store
Retrieving the state of your Internet connection
Converting an integer value to a hexadecimal string
Dynamic strings implemented through VFP Custom class
GDI+: converting image file to another graphics format
Listing INF files in a specified directory
Power capabilities of the system: battery, UPS, sleep and hibernation modes, processor throttling
Retrieving information specific to the current Time Zone
Using GetBinaryType (WinNT only) to determine the type of an executable file
Converting path to original case

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:


 
CLEAR
CLEAR ALL
 
#DEFINE MAX_PATH 260
DO declare
 
? GetFullPath( _vfp.ServerName )
? FULLPATH( _vfp.ServerName )
 
? GetFullPath( "%systemroot\system32%" )
* end of main
 
FUNCTION GetFullPath( cPath As String ) As String
    LOCAL cFileSpec
 
    cPath = GetQualifiedPath(ExpandEnvStrings( m.cPath ))
 
    IF PathIsDirectory(m.cPath) = 0
        cFileSpec = JUSTFNAME(m.cPath)
        cPath = SUBSTR(m.cPath, 1, RAT(m.cFileSpec, m.cPath)-1)
    ELSE
        cFileSpec = ""
    ENDIF
 
    cPath = GetQualifiedPath(GetLongPath(GetShortPath( m.cPath )) +;
        IIF(EMPTY(cFileSpec), "", "\" + cFileSpec) )
RETURN m.cPath
 
FUNCTION ExpandEnvStrings( cStr As String ) As String
    LOCAL cBuffer
    cBuffer = REPLICATE(CHR(0), MAX_PATH)
    ExpandEnvironmentStrings( m.cStr, @cBuffer, MAX_PATH)
RETURN STRTRAN(m.cBuffer, CHR(0), "")
 
FUNCTION GetQualifiedPath( cStr As String ) As String
    LOCAL cBuffer
    cBuffer = REPLICATE(CHR(0), MAX_PATH)
    PathSearchAndQualify( m.cStr, @cBuffer, MAX_PATH)
RETURN STRTRAN(m.cBuffer, CHR(0), "")
 
FUNCTION GetShortPath( cStr As String ) As String
    LOCAL cBuffer
    cBuffer = REPLICATE(CHR(0), MAX_PATH)
    GetShortPathName( m.cStr, @cBuffer, MAX_PATH)
RETURN STRTRAN(m.cBuffer, CHR(0), "")
 
FUNCTION GetLongPath( cStr As String ) As String
    LOCAL cBuffer
    cBuffer = REPLICATE(CHR(0), MAX_PATH)
    GetLongPathName( m.cStr, @cBuffer, MAX_PATH)
RETURN STRTRAN(m.cBuffer, CHR(0), "")
 
PROCEDURE declare
    DECLARE INTEGER ExpandEnvironmentStrings IN kernel32;
        STRING lpSrc, STRING @lpDst, INTEGER nSize
 
    DECLARE INTEGER PathSearchAndQualify IN Shlwapi;
        STRING pcszPath, STRING @pszFullyQualifiedPath,;
        INTEGER cchFullyQualifiedPath
 
    DECLARE INTEGER GetShortPathName IN Kernel32;
        STRING lpszLongPath, STRING @lpszShortPath,;
        INTEGER cchBuffer
 
    DECLARE INTEGER GetLongPathName IN Kernel32;
        STRING lpszShortPath, STRING @lpszLongPath,;
        INTEGER cchBuffer
 
    DECLARE INTEGER PathIsDirectory IN Shlwapi;
        STRING pszPath
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1970 bytes  
Created: 2001-08-14 12:00:00  
Modified: 2011-01-24 13:17:00  
Visits in 7 days: 41  
Listed functions:
ExpandEnvironmentStrings
GetLongPathName
GetShortPathName
PathIsDirectory
PathSearchAndQualify
Printer friendly API declarations
My comment:
The presented procedure also expands environment string (like %SystemRoot%, %Public%, %Temp% and so on) in source path.

File names in some operating systems are case sensitive. This should be considered when, for example, exchanging files with Apache FTP server.
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.180.187)
4 sec.Example: 'Splash Screen for the VFP application'
10.82 min.Example: 'How to print picture stored in enhanced-format metafile (*.emf)'
10.87 min.Example: 'GDI+: reading and writing metadata in JPEG and TIFF files'
2.56 hrs.Function: 'WTSEnumerateServers'
Function group: 'Terminal Services'
 Function: 'waveInGetDevCaps'
Function group: 'Windows Multimedia'
6.96 hrs.Example: 'GDI+: Creating thumbnails to preview images in a directory'
7.11 hrs.Example: 'The original LoadPicture() function in VFP returns valid handles to bitmaps, icons, cursors, and metafiles'
Google
Advertise here!