Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
CryptoAPI: Collection of Providers class
Obtaining addresses for the adapters on the local computer (Win XP/2003/Vista)
Retrieving list of supported paper names (for example, Letter or Legal) for a given printer
Using SQLBrowseConnect to connect to a data source through a number of iterative calls (SQL Server)
Using the GetLogicalDriveStrings
Winsock: retrieving information from a host database for a given host name
Determining whether or not the system is connected to the Internet
How to display picture stored in enhanced-format metafile (*.emf)
How to enumerate sessions and processes on a specified terminal server
Minimizing all running applications
Retrieving geometrical parameters of the system desktop window
Using Custom FTP class (DEFINE CLASS ftp As Custom)
An alternative way of setting Form.Closable to False
Creating hash values for the list of names
GDI+: creating scaled copy of image file
Reading and setting system access privileges for the current process
Reading entries from Event logs
Accessing Windows Control Panel from VFP Application
GDI+: reading and writing metadata in JPEG and TIFF files
How to drag a Form not using its Titlebar or Caption
Simple MAPI: how to pick an email recipient from Outlook Express address book
How to find when the application started
Reading data from INI files
Retrieving the rectangle area where the mouse cursor is confined
How to retrieve information about a cache entry (Internet Explorer)

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
 
*|typedef struct _INTERNET_CACHE_ENTRY_INFO {
*|    DWORD  dwStructSize;         0:4
*|    LPTSTR  lpszSourceUrlName;   4:4
*|    LPTSTR  lpszLocalFileName;   8:4
*|    DWORD  CacheEntryType;      12:4
*|    DWORD  dwUseCount;          16:4
*|    DWORD  dwHitRate;           20:4
*|    DWORD  dwSizeLow;           24:4
*|    DWORD  dwSizeHigh;          28:4
*|    FILETIME  LastModifiedTime; 32:8
*|    FILETIME  ExpireTime;       40:8
*|    FILETIME  LastAccessTime;   48:8
*|    FILETIME  LastSyncTime;     56:8
*|    LPBYTE  lpHeaderInfo;       64:4
*|    DWORD  dwHeaderInfoSize;    68:4
*|    LPTSTR  lpszFileExtension;  72:4
*|    union {                     76:4
*|        DWORD  dwReserved;
*|        DWORD  dwExemptDelta;
*|    };
*|} INTERNET_CACHE_ENTRY_INFO, *LPINTERNET_CACHE_ENTRY_INFO; 80 bytes
 
#DEFINE cnENTRY_INFO_SIZE  80
 
LOCAL lcUrl, lcBuffer, lnBufsize, lnResult
 
* using "Recent Changes" page from FoxForumWiki
lcUrl = "http://fox.wikis.com/wc.dll?Wiki~RecentChanges"
 
*lcBuffer = Chr(cnENTRY_INFO_SIZE) + Repli(Chr(0), cnENTRY_INFO_SIZE-1)
lcBuffer = ""
lnBufsize = 0
 
= GetUrlCacheEntryInfo(lcUrl, @lcBuffer, @lnBufsize)
 
lcBuffer = Chr(cnENTRY_INFO_SIZE) + Repli(Chr(0), lnBufsize)
lnResult = GetUrlCacheEntryInfo(lcUrl, @lcBuffer, @lnBufsize)
 
IF lnResult = 0
*   2 - ERROR_FILE_NOT_FOUND -- file not in cache
* 122 - ERROR_INSUFFICIENT_BUFFER
    ? "Error code:", GetLastError()
    RETURN
ENDIF
 
? lcBuffer
 
LOCAL lnPtr, lcValue
CREATE CURSOR csResult (pname C(50), pvalue C(250))
 
= addparam ("Required buffer size", LTRIM(STR(lnBufsize)))
 
lnPtr = buf2dword(SUBSTR(lcBuffer, 5,4))
lcValue = mem2str(lnPtr)
= addparam ("Source Url", lcValue)
 
lnPtr = buf2dword(SUBSTR(lcBuffer, 9,4))
lcValue = mem2str(lnPtr)
= addparam ("Local file name", lcValue)
 
lnPtr = buf2dword(SUBSTR(lcBuffer, 13,4))
= addparam ("Cache type bitmask", LTRIM(STR(lnPtr)))
 
lnPtr = buf2dword(SUBSTR(lcBuffer, 17,4))
= addparam ("User count of the cache entry", LTRIM(STR(lnPtr)))
 
lnPtr = buf2dword(SUBSTR(lcBuffer, 21,4))
= addparam ("Times the cache entry was retrieved", LTRIM(STR(lnPtr)))
 
lnPtr = buf2dword(SUBSTR(lcBuffer, 25,4))
= addparam ("Low order of the file size", LTRIM(STR(lnPtr)))
 
lnPtr = buf2dword(SUBSTR(lcBuffer, 29,4))
= addparam ("High order of the file size", LTRIM(STR(lnPtr)))
 
lcValue = FTime2ITime(SUBSTR(lcBuffer, 33,8))
= addparam ("Time last modified", lcValue)
 
lcValue = FTime2ITime(SUBSTR(lcBuffer, 41,8))
= addparam ("Time file expires", lcValue)
 
lcValue = FTime2ITime(SUBSTR(lcBuffer, 49,8))
= addparam ("Time last access", lcValue)
 
lcValue = FTime2ITime(SUBSTR(lcBuffer, 57,8))
= addparam ("Time cache synchronized", lcValue)
 
lnPtr = buf2dword(SUBSTR(lcBuffer, 65,4))
lcValue = mem2str(lnPtr)
= addparam ("Header Info", lcValue)
 
GO TOP
BROWSE NORMAL NOWAIT
* end of main
 
FUNCTION AddParam (lcName, lcValue)
    INSERT INTO csResult VALUES (lcName, lcValue)
RETURN
 
FUNCTION  buf2dword (lcBuffer)
RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
    BitLShift(Asc(SUBSTR(lcBuffer, 2,1)),  8) +;
    BitLShift(Asc(SUBSTR(lcBuffer, 3,1)), 16) +;
    BitLShift(Asc(SUBSTR(lcBuffer, 4,1)), 24)
 
FUNCTION  mem2str(lnMemBlock)
#DEFINE BUFFER_SIZE   16
#DEFINE EMPTY_BUFFER  Repli(Chr(0), BUFFER_SIZE)
 
    DECLARE RtlMoveMemory IN kernel32 As Heap2Str;
        STRING @, INTEGER, INTEGER
 
    LOCAL lnPtr, lcResult, lcBuffer, lnPos
    lnPtr = lnMemBlock
    lcResult = ""
 
    DO WHILE .T.
        lcBuffer = EMPTY_BUFFER
        = Heap2Str (@lcBuffer, lnPtr, BUFFER_SIZE)
        lnPos = AT(Chr(0), lcBuffer)
 
        IF lnPos > 0
            lcResult = lcResult + SUBSTR(lcBuffer, 1, lnPos-1)
            RETURN  lcResult
        ELSE
            lcResult = lcResult + lcBuffer
            lnPtr = lnPtr + BUFFER_SIZE
        ENDIF
    ENDDO
 
FUNCTION FTime2ITime (lcFiletime)
#DEFINE cnSYSTIME_SIZE  16
#DEFINE INTERNET_RFC1123_FORMAT   0
#DEFINE INTERNET_RFC1123_BUFSIZE  30
 
    LOCAL lcSysTime, lcInetTime
    lcSysTime = Repli(Chr(0), cnSYSTIME_SIZE)
    = FileTimeToSystemTime(lcFiletime, @lcSysTime)
 
    lcInetTime = Repli(Chr(0), INTERNET_RFC1123_BUFSIZE)
    = InternetTimeFromSystemTime(@lcSysTime, INTERNET_RFC1123_FORMAT,;
        @lcInetTime, INTERNET_RFC1123_BUFSIZE)
RETURN STRTRAN(lcInetTime, Chr(0),"")
 
PROCEDURE decl
    DECLARE INTEGER InternetTimeFromSystemTime IN wininet;
        STRING @pst, INTEGER dwRFC, STRING @lpszTime,;
        INTEGER cbTime
 
    DECLARE INTEGER FileTimeToSystemTime IN kernel32;
        STRING lpFileTime, STRING @lpSystemTime
 
    DECLARE INTEGER GetLastError IN kernel32
 
    DECLARE INTEGER GetUrlCacheEntryInfo IN wininet;
        STRING lpszUrlName, STRING @lpCacheEntryInfo,;
        INTEGER @lpdwCacheEntryInfoBufferSize
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
4699 bytes  
Created: 2002-08-13 14:45:47  
Modified: 2004-09-12 17:16:19  
Visits in 7 days: 97  
Listed functions:
FileTimeToSystemTime
GetLastError
GetUrlCacheEntryInfo
InternetTimeFromSystemTime
Printer friendly API declarations
My comment:


#kwd: sln_http.
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 (184.73.74.47)
7 sec.Example: 'GDI+: loading image file, drawing on it, saving the result to another file'
1.65 hrs.Example: 'How to change the name and the size of the font in the MessageBox dialog'
1.66 hrs.Function: 'GdipSetPageScale'
Function group: 'GDI+ Graphics'
9.78 hrs.Function: 'GetFileAttributes'
 Example: 'How to access a file using not its name but an alias (hard link)'
13.38 hrs.Example: 'GDI+: rotating images using matrix transformations'
 Example: 'How to obtain Content-Type value for a file type from the System Registry'
 Example: 'How to enumerate, add and delete shares on the local computer (WinNT/XP)'
15.12 hrs.Example: 'GDI+: Creating thumbnails to preview images in a directory'
 Function: 'CryptDestroyKey'
Google
Advertise here!