Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Enumerating ODBC Data Sources available on the local computer
Obtaining names of local and global groups for current user (WinNT/XP/2K)
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Retrieving a universal form for the drive-based path for a network resource
Retrieving configuration information for the specified server (Win98/Me)
Retrieving Network Provider information
Wininet last error description
Extracting the name and extension parts of a path string
High-powered ALLTRIM
How to get Special Folders paths
How to obtain the number of rows affected by remote UPDATE, INSERT or DELETE statement
Initiating Inet connection using a modem
Monitoring changes in a directory
Obtaining OS memory performance information
Quering Audio Mixer Device
Reading parameters of streams in AVI file
Storing registration key in the resources of an executable file
Using shared memory to exchange data between two FoxPro applications
Accessing Windows Control Panel from VFP Application
Enumerating files opened on the network
GDI+: converting image file to another graphics format
How to browse and connect to printers on a network (WinNT)
How to perform Base64 encoding/decoding using Cryptography API Functions
Pocket PC: Folder Viewer
Using the SystemParametersInfo function

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:
Use the SystemParametersInfo function to retrieve and set various system parameters: desktop, isons, mouse, screen saver, windows parts sizing etc.
 
*    DO p1  && work area
    DO p2  && retrieving screen saver parameters
*    DO p3  && setting a wallpaper
 
PROCEDURE  p3
* setting a wallpaper
#DEFINE SPI_SETDESKWALLPAPER    20
#DEFINE SPIF_SENDWININICHANGE 1
#DEFINE SPIF_UPDATEINIFILE 2
 
    DECLARE INTEGER SystemParametersInfo IN user32;
        INTEGER uiAction, INTEGER uiParam,;
        STRING @pvParam, INTEGER fWinIni
 
    LOCAL lcWallpaper, nFlag
    nFlag = SPIF_UPDATEINIFILE + SPIF_SENDWININICHANGE
    lcWallpaper = "c:\windows\pinstripe.bmp" && a valid image file
*    lcWallpaper = ""  && removes the wallpaper
 
    = SystemParametersInfo (SPI_SETDESKWALLPAPER,;
        0, @lcWallpaper, nFlag)
 
PROCEDURE  p2
* retrieving screen saver parameters
#DEFINE SPI_GETSCREENSAVEACTIVE     16 
#DEFINE SPI_GETSCREENSAVERRUNNING  114 
#DEFINE SPI_GETSCREENSAVETIMEOUT    14 
 
    DECLARE INTEGER SystemParametersInfo IN user32;
        INTEGER uiAction, INTEGER uiParam,;
        INTEGER @pvParam, INTEGER fWinIni
 
    LOCAL lnBuffer
    lnBuffer = 0
 
    = SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, @lnBuffer, 0)
    ? "Screen saving is enabled:", lnBuffer
 
    * Windows 98/Me, Windows 2000/XP
    = SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, @lnBuffer, 0)
    ? "Screen saving is currently running:", lnBuffer
 
    = SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, @lnBuffer, 0)
    ? "Screen saver time-out value, seconds:", lnBuffer
 
PROCEDURE  p1
* retrieving the size of the work area on the primary display monitor. 
* The work area is the portion of the screen not obscured 
* by the system taskbar or by application desktop toolbars.
#DEFINE SPI_GETWORKAREA    48
 
    LOCAL lcBuffer
    lcBuffer = Repli(Chr(0), 16)
 
    DECLARE INTEGER SystemParametersInfo IN user32;
        INTEGER uiAction, INTEGER uiParam,;
        STRING @pvParam, INTEGER fWinIni
 
    = SystemParametersInfo(SPI_GETWORKAREA, 0, @lcBuffer, 0)
 
    ? "Left:", buf2dword(SUBSTR(lcBuffer, 1,4))
    ? "Top:", buf2dword(SUBSTR(lcBuffer, 5,4))
    ? "Right:", buf2dword(SUBSTR(lcBuffer, 9,4))
    ? "Bottom:", buf2dword(SUBSTR(lcBuffer, 13,4))
 
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)
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
2254 bytes  
Created: 2002-02-26 00:40:53  
Modified: 2003-02-26 15:57:41  
Visits in 7 days: 80  
Listed functions:
SystemParametersInfo
Printer friendly API declarations
My comment:
Note that the declaration for the SystemParametersInfo varies depending on type of the returned parameter.

MSDN: Tip 192: Selecting a New Desktop Wallpaper
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.242.233.11)
3 sec.Example: 'Opening the Page Setup dialog box to specify the attributes of a printed page'
1.8 hrs.Example: 'Pocket PC: retrieving data from the Contacts Database'
3.77 hrs.Example: 'Using Extended MessageBox() Class'
 Function: 'NetApiBufferSize'
Function group: 'Network Management'
5.9 hrs.Function: 'GetPhysicalMonitorsFromHMONITOR'
 Example: 'Using the Semaphore object'
6.56 hrs.Example: 'Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)'
 Function: 'RegDeleteKey'
7.95 hrs.Example: 'How to enumerate terminal servers within the specified Windows domain'
7.96 hrs.Function: 'WindowFromDC'
Google
Advertise here!