Show borders only:
The above method does not work. You can only use the systemparametersinfo + spi_setdragfullwindows parameter to set whether to display the content in the window when moving the window:
Systemparametersinfo (spi_setdragfullwindows, false, spif_updateinifile );
You can use the systemparametersinfo function to obtain and set a large number of windows system parameters. The automatic wallpaper change program uses the systemparametersinfo function to set the wallpaper of the desktop. Moreover, the program allows us to select multiple wallpaper images, and the program will automatically change the wallpaper at a certain interval.
Let's take a look at the definition and parameters of the systemparametersinfo function:
Before using the API function, you must declare the following in the program:
Private declare function systemparametersinfo lib "USER32" alias "systemparametersinfoa" (byval uaction as long, byval uparam as long, byval lpvparam as any, byval fuwinini as long) as long
The meanings of parameters are as follows:
Parameter: Meaning
Uaction long, which specifies the parameter to be set. Refer to the uaction constant table.
Uparam long, refer to the uaction constant table
Lpvparam any, which is based on the integer, long, and data structure called by reference.
The fuwinini parameter specifies whether to update user-defined parameters when setting system parameters.
Below are some uaction parameters and their usage methods:
Parameter meaning and usage
6. Set the window size, systemparametersinfo (6, zoom in and out, P, 0), and lpvparam to long.
17. Enable the screensaver, systemparametersinfo (17, false, P, 1), and uparam is boolean.
The horizontal and vertical spacing of the desktop icon is changed at, the uparam is the spacing value (pixel), and The lpvparam is the long type.
15 set the screen saver wait time, systemparametersinfo (15, seconds, P, 1), and lpvparam as long
20 set the desktop background wallpaper, systemparametersinfo (20, true, image path, 1)
93 switch the mouse track, systemparametersinfo (93, value, P, 1), and uparam is false, disable
97 switch CTRL + ALT + DEL window, systemparametersinfo (97, false, A, 0), uparam is Boolean
In this example, select an image and obtain the complete path of the image. Then, call the API function to set the image as a wallpaper. The syntax used is systemparametersinfo spi_set1_wallpaper, 0, BMP file, 1.
Systemparametersinfo indicates that you want to set the desktop wallpaper. BMP file is the path of the image to be set.
In this example, the timer automatic replacement is implemented through the timer control. We can adjust the interval attribute of the timer control to change the Interval Length. So that you can see the changing desktop //-------------------------------------------------------------------------
Detailed usage of systemparametersinfo
At the request of a student, let's take a look at this API.
Set and obtain Windows system parameters. Now let's analyze in detail (its function is powerful)
The following example shows how to obtain the Work Area
Procedure centerwindow (winhnd: hwnd; winwidth: integer; winheight: integer );
VaR
Screendim: trect;
Screenleft: integer;
Screentop: integer;
Begin
Systemparametersinfo (spi_getworkarea, 0, @ screendim, 0 );
Screenleft: = trunc (screendim. Right-screenDim.Left)/2)-(winwidth/2 ));
Screentop: = trunc (screendim. Bottom-screenDim.Top)/2)-(winheight/2 ));
Setwindowpos (winhnd, hwnd_topmost, screenleft, screentop, winwidth, winheight, 0 );
End;
Procedure tform1.button1click (Sender: tobject );
Begin
Centerwindow (FIG, 200,200 );
End;
Now you can try it out.
Spi_getaccesstimeout lpvparam is an accesstimeout structure, in which the timing information of the secondary access feature should be loaded. Before calling a function, uparam must be set to the size of the accesstimeout structure.
Spi_getanimation lpvparam is an animationinfo structure that minimizes and restores animation information during loading windows. Cannot be used in NT 3.51
Spi_getbeep lpvparam is a long data type. If the bell sound is enabled, it is set to true.
Spi_getborder lpvparam is a long-type data that receives a multiplier and controls the border size of a Variable Window.
Spi_getdefaultinputlang lpvparam is a long-type data that receives a 32-bit handle from the default keyboard layout. Cannot be used for NT 3.51
Spi_getdragfullwindows lpvparam is a long data type. If you drag the data in the window, it is set to true. If only one rectangular profile is dragged out, the value is false. NT 4.0 or Windows 95 is required. Windows 95 must have a plus! Yes, or install Windows 95 osr2 directly
Spi_getfasttaskswitch lpvparam is a long data type. It is true if fast task switching is allowed. It must be true in Windows 95 and NT 4.0
Spi_getfilterkeys lpvparam is a filterkeys structure used to load auxiliary access feature information related to the keyboard.
Spi_getfontsmoothing lpvparam is a long data type. If the edge modifier is enabled (to make the font more mellow), it is true. Applicable only to NT 4.0 and with plus! Supported Windows 95
Spi_getgridgranularity lpvparam is a long data, which is set to the grid interval size value.
Spi_gethighcontrast lpvparam is a highcontrast structure used to load auxiliary access feature information related to user monitors. Applicable only to Win95
Spi_geticonmetrics lpvparam is an iconmetrics structure used to load information related to the proportions and arrangement of icons. Applicable only to Windows 95 and NT 4.0
Spi_geticontitlelogfont lpvparam points to a logfont structure. The setting content depends on the font used by the icon title.
Spi_geticontitlewrap lpvparam is a long data type. If you allow automatic line feed on the icon title, set it to true.
Spi_getkeyboarddelay lpvparam is a long-type data set as a keyboard repetition Delay
Spi_getkeyboardpref lpvparam is a long data type. If you prefer to use a keyboard instead of a mouse, set it to true. If this parameter is true, Windows displays the attached keyboard interface information, only applicable to Win95
Spi_getkeyboardspeed lpvparam is a long-type data set as the repeat rate of the keyboard
Spi_getmenudropalignment lpvparam is a long data type. If the pop-up menu is left aligned (default), it is set to false. Otherwise, it is true.
Spi_getminimizedmetrics lpvparam is a minimizedmetrics structure used to load information related to minimizing the ratio and arrangement of windows. Applicable only to Win95
Spi_getmouse lpvparam is the first entry in the long array of three elements. Entry 0 is set to the mousethreshold1 field configured for the user, entry 1 is set to the mousethreshold2 field, and entry 2 is set to mousespeed.
Spi_getmousekeys lpvparam is a mousekeys structure in which secondary access information related to the mouse needs to be loaded. Cannot be used in NT 3.51
Spi_getnonclientmetrics lpvparam is a nonclientmetrics structure in which information about fonts and environments should be loaded. This information will be involved in describing non-customer areas of a window, such as borders and titles. Applicable only to Win95
Spi_getscreensaveactive lpvparam points to an integer. If the Screen Saver is active, set it to true; otherwise, set it to false.
Spi_getscreensavetimeout lpvparam points to an integer. It is set to screen protection latency (in seconds)
Spi_getserialkeys lpvparam is a serialkeys structure used to load auxiliary access feature information related to the input device (used to simulate keyboard input. Applicable only to Win95
Spi_getshowsounds lpvparam is a long data type. If the application should replace the sound with a visual clue, set it to true. It serves the same purpose as the sm_getshowsounds option of the getsystemmetrics function.
Spi_getsnaptodefbutton lpvparam is a long data type. If the cursor is automatically moved to the default button in the new dialog box, it is set to true. Applicable only to NT 4.0
Spi_getsoundsentry lpvparam is a soundsentry structure that is used to load auxiliary access feature information involved in providing visual signs (rather than system sounds) for Windows. Before calling, you must set uparam to the length of the soundsentry structure.
Spi_getstickykeys lpvparam is a stickykeys structure used to load auxiliary access feature information that is involved when a user-ordered key is allowed (rather than simultaneously pressed. Examples of simultaneous buttons include SHIFT +, CTRL +, and ALT +. Before calling, you must set uparam to the length of the stickykeys structure.
Spi_gettogglekeys lpvparam is a ToggleKeys structure. It is required to load the secondary access feature information involved in playing sound prompts after the next enable key (numlock, capslock, scrolllock) is loaded. Windows uses a different voice to indicate the ON or OFF status. Before calling, you must set uparam to the length of the ToggleKeys structure.
Spi_getworkarea lpvparam is a rect structure used to load the workspace of the screen.
Spi_iconhorizontalspacing. If lpvparam is null, uparam indicates the new horizontal distance of the desktop icon, in pixels.
Spi_iconverticalspacing is similar to spi_iconhorizontalspacing, but it only specifies the Vertical spacing of the icon.
Spi_langdriver lpvparam is a string used to hold the name of the new language driver File
The parameters of spi_setaccesstimeout and spi_getaccesstimeout are the same.
The parameters of spi_setanimation and spi_getanimation are the same.
If spi_setbeep uparam is set to true, enable the bell function. If false, disable the function.
Spi_setborder uparam represents a multiplier used to control the size of the window border with variable sizes.
The parameters of spi_setdefaultinputlang and spi_getdefaultinputlang are the same.
Spi_setpattern pattern forces the window from the registry or win. ini to restore the current desktop Solution
Spi_setdeskwallpaper lpvparam represents a string used to hold the name of a bitmap file used as a desktop Wallpaper
Spi_setdoubleclicktime uparam indicates the interval (in milliseconds) between two consecutive double-click operations)
Spi_setdoubleclkheight uparam indicates the new double-click height. For details, refer to the annotation of the getsystemmetrics function.
Spi_setdoubleclkwidth uparam indicates the new double-click width. For details, refer to the annotation of the getsystemmetrics function.
If spi_dragfullwindows uparam is set to true, open the entire window and drag it. Otherwise, set it to false. Applicable only to Win95
Spi_setdragheight uparam indicates the height of a rectangle (in pixels), used to determine when the drag operation starts. Applicable only to Win95
Spi_setdragwidth uparam indicates the width of a rectangle (in pixels), used to determine when the drag operation starts. Applicable only to Win95
If the value of spi_setfasttaskswitch uparam is true, enable quick Task Switching. If the value is false, disable quick task switching.
The parameter spi_filterkeys is the same as that of spi_getfilterkeys.
If spi_setfontsmoothing uparam is set to true, the font is rounded ). Only NT 4.0 and get plus! Supported Win95 (or Windows 95 osr2)
Spi_setgridgranularity uparam indicates the new grid spacing.
The parameter spi_sethighcontrast is the same as that of spi_gethighcontrast.
The parameter spi_seticonmetrics is the same as that of spi_geticonmetrics.
Spi_seticontitlelogfont lpvparam is a logfont structure used to define the font used by the icon title. Uparam specifies the size of the logfont structure. If both are null, the font defined at system startup is used.
When spi_seticontitlewrap uparam is set to true, the icon title is automatically wrapped.
Spi_setkeyboarddelay uparam indicates the duplicate latency of the new keyboard.
If the value of spi_setkeyboardpref is true, it indicates that the user prefers the former compared with the keyboard and mouse. Refer to spi_getkeyboardpref
Spi_setkeyboardspeed uparam indicates the new keyboard repetition rate
Spi_setlangtoggle enables the window to reload the hotkey information from the system registry for exchange between keyboard la s
If spi_setlowpoweractive uparam is set to true, the screen saver mode is enabled. Applicable only to Win95
Spi_setlowpowertimeout uparam represents the latency of the new energy-saving screen saver. Applicable only to Win95
When spi_setmenudropalignment uparam is set to false, the left alignment of the pop-up menu is set. If it is true, the right alignment is set.
The parameter spi_setminimizedmetrics is the same as that of spi_getminimizedmetrics.
Spi_setmouse lpvparam is the first entry of a three-element integer array, which contains the mouse settings. Refer to spi_getmouse
If the value of spi_setmousebuttonswap uparam is true, the left and right mouse buttons are switched. If the value is false, the original value is used.
The parameter spi_setmousekeys is the same as that of spi_getmousekeys.
The parameter spi_setnonclientmetrics is the same as the parameter spi_getnonclientmetrics.
When spi_setpenwindows uparam is true, load the pen window. If it is false, uninstall
If the value of spi_setpoweroffactive uparam is true, screen protection mode is enabled. Applicable only to Win95
Spi_setpowerofftimeout uparam represents the latency of the screen saver for new power outages. Applicable only to Win95
When spi_setscreenreader uparam is set to true, a screen reading program is running. Refer to spi_getscreenreader
If spi_setscreensaveactive uparam is set to true, the screen saver is activated. If false, the screen saver is disabled.
Spi_setscreensavetimeout uparam indicates the New Screen Protection delay time, in seconds
The spi_setserialkeys parameter is the same as the spi_getserialkeys parameter.
When spi_setshowsounds uparam is set to true, the window is allowed to enable the sound prompt feature. Refer to spi_getshowsounds
Spi_setsnaptodefbutton if the mouse should automatically move to the default button in the new dialog box, uparam is true. Applicable only to NT 4.0
Spi_setsoundsentry is the same as spi_getsoundsentry.
Spi_setstickykeys is the same as spi_getstickykeys.
Spi_settogglekeys is the same as spi_gettogglekeys.
Spi_setworkarea is the same as spi_getworkarea.