Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Locking and unlocking file of a VFP table
Obtaining MAC address through Address Resolution Protocol (ARP) request
Reading Internet Query options
Retrieving the IP-to-physical address mapping table
Using the Semaphore object
Pocket PC: System Registry Viewer
Using IsChild() for testing ThisForm.ShowWindow property
Who owns the Windows Clipboard
Winsock: initializing the service in the VFP application
Building a tree of subdirectories for a given path using FindFile functions
Current System information
Hiding mouse cursor
How to drag a Form not using its Titlebar or Caption
Reading current hardware profile
Memory usage info for current VFP session (WinNT only)
Retrieving information about all users currently logged on to the workstation (WinNT only)
Determining whether or not the system is connected to the Internet
Enumerating connections made to a shared resource for the local computer (WinNT only)
How to play a waveform sound (a WAV file in particular)
Obtaining heap handles and enumerating memory blocks for the current VFP session (WinNT only)
Retrieving geometrical parameters of the system desktop window
Changing system colors
GDI+: enumerating fonts installed on the system
Using the GetLogicalDriveStrings
Retrieving information specific to the current Time Zone

User rating: 10/10 (1 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
 
*| typedef struct _TIME_ZONE_INFORMATION { 
*|     LONG       Bias;                  0        4
*|     WCHAR      StandardName[ 32 ];    4       64
*|     SYSTEMTIME StandardDate;         68       16
*|     LONG       StandardBias;         84        4
*|     WCHAR      DaylightName[ 32 ];   88       64
*|     SYSTEMTIME DaylightDate;        152       16
*|     LONG       DaylightBias;        168        4
*| } TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION; total 172 bytes
#DEFINE TIME_ZONE_SIZE  172
DO decl
 
LOCAL cTimeZone, cTimeZone_, nId
cTimeZone = Repli(Chr(0), TIME_ZONE_SIZE)
 
? "*** Retrieving current TimeZone info..."
nId = GetTimeZoneInformation(@cTimeZone)
= ShowTimeZoneInfo(cTimeZone)
 
?
? "*** Changing bias and standard name parameters..."
LOCAL nNewBias, cStandardName, cDaylightName
nNewBias = 301
*cStandardName = PADR(StrConv("Scarborough Standard",5),64,Chr(0))
cStandardName = PADR("My City Standard", 64, Chr(0))
cDaylightName = PADR("My City Daylight", 64, Chr(0))
cTimeZone_ = num2dword(nNewBias) + cStandardName +;
    SUBSTR(cTimeZone, 69, 20) +;
    cDaylightName +;
    SUBSTR(cTimeZone, 153)
 
= SetTimeZoneInformation(cTimeZone_) && setting
cTimeZone_ = Repli(Chr(0), TIME_ZONE_SIZE)  && clearing buffer
= GetTimeZoneInformation(@cTimeZone_) && re-populating buffer
= ShowTimeZoneInfo(cTimeZone_)
 
?
? "*** Back to old settings..."
= SetTimeZoneInformation(cTimeZone)
cTimeZone = Repli(Chr(0), TIME_ZONE_SIZE)
= GetTimeZoneInformation(@cTimeZone)
= ShowTimeZoneInfo(cTimeZone)
* end of main
 
FUNCTION GetTimeZoneType(nId)
#DEFINE TIME_ZONE_ID_UNKNOWN     0
#DEFINE TIME_ZONE_ID_STANDARD    1
#DEFINE TIME_ZONE_ID_DAYLIGHT    2
    DO CASE
    CASE nId = TIME_ZONE_ID_STANDARD
        RETURN "StandardDate member"
    CASE nId = TIME_ZONE_ID_DAYLIGHT
        RETURN "DaylightDate member"
    CASE nId = TIME_ZONE_ID_UNKNOWN
        RETURN "The system cannot determine the current time zone"
    OTHER
        RETURN "The Time Zone ID is invalid"
    ENDCASE
 
PROCEDURE ShowTimeZoneInfo(cTimeZone)
    ? "Bias (minutes between UTC and local):", buf2dword(SUBSTR(cTimeZone, 1,4))
    ? "Standard Bias:", buf2dword(SUBSTR(cTimeZone, 85,4))
    ? "Daylight Bias:", buf2dword(SUBSTR(cTimeZone, 169,4))
    ? "Standard name:", STRTRAN(SUBSTR(cTimeZone, 5,32), Chr(0),"")
    ? "Daylight name:", STRTRAN(SUBSTR(cTimeZone, 89,32), Chr(0),"")
    ? "Standard Date:",;
        buf2word(SUBSTR(cTimeZone,69,2)),;
        buf2word(SUBSTR(cTimeZone,71,2)),;
        buf2word(SUBSTR(cTimeZone,73,2)),;
        buf2word(SUBSTR(cTimeZone,75,2)),;
        buf2word(SUBSTR(cTimeZone,77,2)),;
        buf2word(SUBSTR(cTimeZone,79,2))
    ? "Daylight Date:",;
        buf2word(SUBSTR(cTimeZone,153,2)),;
        buf2word(SUBSTR(cTimeZone,155,2)),;
        buf2word(SUBSTR(cTimeZone,157,2)),;
        buf2word(SUBSTR(cTimeZone,159,2)),;
        buf2word(SUBSTR(cTimeZone,161,2)),;
        buf2word(SUBSTR(cTimeZone,163,2))
 
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 buf2word(lcBuffer)
RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
       Asc(SUBSTR(lcBuffer, 2,1)) * 256
 
FUNCTION num2dword(lnValue)
#DEFINE m0  256
#DEFINE m1  65536
#DEFINE m2  16777216
    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)
 
FUNCTION num2word(lnValue)
RETURN Chr(MOD(m.lnValue,256)) + CHR(INT(m.lnValue/256))
 
PROCEDURE decl
    DECLARE INTEGER GetTimeZoneInformation IN kernel32;
        STRING @lpTimeZoneInformation
 
    DECLARE INTEGER SetTimeZoneInformation IN kernel32;
        STRING lpTimeZoneInformation
 
 
 

User rating: 10/10 (1 votes)
Rate this code sample:
  • ~
3808 bytes  
Created: 2001-07-25 12:00:00  
Modified: 2004-06-18 16:07:56  
Visits in 7 days: 66  
Listed functions:
GetTimeZoneInformation
SetTimeZoneInformation
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-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)
3 sec.Example: 'How to find when the application started'
6 sec.Links
Page 4
1.01 hrs.Example: 'How to make a VFP form fading out when released (GDI version)'
2.33 hrs.Function: 'SQLGetEnvAttr'
Function group: 'ODBC API'
2.92 hrs.Example: 'Displaying the associated icons and descriptions for files and folders'
4.06 hrs.Function: 'ReleaseDC'
Function group: 'Device Context'
 Function: 'EndPath'
Function group: 'Path'
7.79 hrs.Example: 'How to display the Print property sheet'
21.21 hrs.Example: 'Creating a file, then moving it to another destination'
 
Google
Advertise here!