Setting Windows Wallpaper

Setting Windows Wallpaper

I am trying to use the API call SystemParametersInfo to change the Windows wallpaper. It works great in a Borland C program I wrote, but doesn’t work in VB. All that happens is that the wallpaper turns blue.

The API call you should have declared in VB should look like this:

Declare Function SystemParametersInfo Lib “User”(ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParamAs Any, ByVal fuWinIni As Integer) As Integer

In this declare statement, Microsoft forgot to put a ByVal in front of lpvParam, so it wouldn’t work. Once you fix that, this example works fine:

   Dim retval As Integer   Dim iAction As Integer   Dim iParam As Integer   Dim sParam As String * 12   Dim iUpdateINI As Integer   iAction = 20   ‘ Wallpaper parameter   iParam = 0     ‘ unused, but should be set   sParam = “ARGYLE.BMP”   iUpdateINI = 3   retval = SystemParametersInfo(ByVal iAction, ByVal iParam, ByVal sParam, ByVal iUpdateINI)
Refer to the Windows 3.1 SDK for more information on the SystemParametersInfo API call. This problem with the missing ByVal is not limited to that function. It also exists in several of the functions that read Windows INI files. For the most part, every parameter needs a ByVal in it to work correctly. If you see other statements where all the fields but one have a ByVal and it does not work, try adding the ByVal first. It will probably take care of the problem.

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as