Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Accessing the list of Windows Recent Documents
Copying files as a transacted operation (Vista)
Retrieving statistics for the TCP protocol running on the local computer
Retrieving the path of the printer-driver directory and printer-processor directory
Converting characters to upper or lower case
Creating a file, then moving it to another destination
CryptoAPI: retrieving list of providers
Listing device drivers in the system: load addresses, names
Obtaining window class name for the main VFP window
Searching for the specified file using the SearchPath
GDI+: loading image file, drawing on it, saving the result to another file
Retrieving national language settings
Enumerating Performance Counters
Joining local computer to a domain (XP/2000)
Finding the application, icon and friendly names associated with a file name
How to access a file using not its name but an alias (hard link)
PocketPC: creating directories and files
Obtaining the System and Windows folder names
Retrieving default spooling directory name
Using ActiveX control for adding a menu directly to a FoxPro MDI form
How to fill a buffer with random bytes using Cryptography API Functions
Setting the last-error code for the FoxPro
Using GetCompressedFileSize (WinNT only)
Displaying the color palette stored in an image file
Managing Cookies

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 declare
 
LOCAL lcUrl, lcCookieName, lcCookieData, lnLen
lcUrl = "http://www.news2news.com/vfp"
lcCookieName = "user settings"
lcCookieData = "regular,54,126,-1,0"
 
*    = AddPersistentCookie(lcUrl, lcCookieName,;
        lcCookieData, date()+2)
 
    ? "Cookie:", ReadCookie(lcUrl, lcCookieName)
 
*    = DeleteCookie(lcUrl, lcCookieName)
*    ? ReadCookie(lcUrl, lcCookieName)
 
FUNCTION ReadCookie(lcUrl, lcCookieName)
    LOCAL lcCookieData, lnLen, lcResult
    lnLen = 4096
    lcCookieData = SPACE(lnLen)
    lcResult = ""
 
    IF InternetGetCookie(lcUrl, lcCookieName, @lcCookieData, @lnLen) <> 0
        lcResult = LEFT(lcCookieData, lnLen-1)
    ELSE
    * 259 = No more data is available
    ENDIF
RETURN lcResult
 
PROCEDURE AddSessionCookie(lcUrl, lcCookieName, lcCookieData)
* Session cookies are stored in memory and can be accessed 
* only by the process that created them.
    = InternetSetCookie(lcUrl, lcCookieName, lcCookieData)
 
PROCEDURE AddPersistentCookie(lcUrl, lcCookieName, lcCookieData, lvExpires)
* Persistent cookies are cookies that have an expiration date. 
* These cookies are stored in the Windows\System directory.
    = InternetSetCookie(lcUrl, lcCookieName,;
        lcCookieData + ";expires=" + toGMTString(lvExpires))
 
PROCEDURE DeleteCookie(lcUrl, lcCookieName)
* To delete a persistent cookie you must set its expiry date 
* to a time that has already expired.
* Usually it keeps staying as a session cookie after being deleted
 
    = AddPersistentCookie(lcUrl, lcCookieName,;
        "", date()-1)
 
FUNCTION toGMTString(ltDate)
* returns datetime formatted as DAY, DD-MMM-YYYY HH:MM:SS GMT
RETURN SUBSTR("SunMonTueWedThuFriSat",;
        (DOW(ltDate,1)-1)*3+1, 3) + ", " +;
    STRTR(STR(Day(ltDate), 2), " ","0") + "-" +;
    SUBSTR("JanFebMarAprMayJunJulAugSepOctNovDec",;
        (MONTH(ltDate)-1)*3+1, 3) + "-" +;
    STR(YEAR(ltDate),4) + " " +;
    STRTR(STR(HOUR(ltDate), 2), " ","0") + ":" +;
    STRTR(STR(MINUTE(ltDate), 2), " ","0") + ":" +;
    STRTR(STR(SEC(ltDate), 2), " ","0") + " GMT"
 
PROCEDURE declare
    DECLARE INTEGER InternetGetCookie IN wininet;
        STRING lpszUrlName, STRING lpszCookieName,;
        STRING @lpszCookieData, INTEGER @lpdwSize
 
    DECLARE INTEGER InternetSetCookie IN wininet;
        STRING lpszUrl, STRING lpszCookieName,;
        STRING lpszCookieData
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
2283 bytes  
Created: 2001-11-02 18:45:27  
Modified: 2006-01-05 13:27:19  
Visits in 7 days: 70  
Listed functions:
InternetGetCookie
InternetSetCookie
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.72.184.104)
4 sec.Function: 'PageSetupDlg'
8.6 hrs.Example: 'Configuring DEVMODE structure for a printer'
8.61 hrs.Example: 'Starting external program from VFP and waiting for its termination'
12.54 hrs.
Function group: 'Painting and Drawing'
12.55 hrs.Function: 'FindWindow'
13.13 hrs.Example: 'How to put a horizontal text scrolling on the form (a news line)'
 Function: 'FindNextPrinterChangeNotification'
16.86 hrs.Function: 'CeCreateProcess'
 Example: 'How to ping a remote site using IP Helper API calls'
19.86 hrs.Function: 'WinHttpConnect'
Google
Advertise here!