Change Desktop background using VB.NET
By : user1770648
Date : March 29 2020, 07:55 AM
will be helpful for those in need Is it possible to change desktop background using VB.NET? code :
'Steps you will do.
'Start visual studio 2005 and create a new window project.
'Set the following properties of the form
'Text = "Set Wallpaper"
'Size = “1024,750”
'Now drip a picture box control on the form and set its following properties.
'Size = “1024,725”
'Sizemode = ”centerimage”
'Drop a two button controls on the form and set its following properties as below.
'First button control.
'Name = " btgetimage"
'Text = " Brows For Image"
'Second button control.
'Name = " btsetwallpaper"
'Text = " Set Wallpaper"
'Now drop an openfiledialog control on the form.
'Open you code window and import the following namespace.
Imports System.IO.Directory
'Now declare the function and variables as below which will use win API's to set the wallpaper.
Private Const SPI_SETDESKWALLPAPER As Integer = &H14
Private Const SPIF_UPDATEINIFILE As Integer = &H1
Private Const SPIF_SENDWININICHANGE As Integer = &H2
Private Declare Auto Function SystemParametersInfo Lib "user32.dll" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
Const WallpaperFile As String = "c:\wallpaper.bmp"
'Make a function as below.
Friend Sub SetWallpaper(ByVal img As Image)
Dim imageLocation As String
imageLocation = My.Computer.FileSystem.CombinePath(My.Computer.FileSystem.SpecialDirectories.MyPictures, WallpaperFile)
Try
img.Save(imageLocation, System.Drawing.Imaging.ImageFormat.Bmp)
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, imageLocation, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
Catch Ex As Exception
MsgBox("There was an error setting the wallpaper: " & Ex.Message)
End Try
End Sub
'Now in the click event of the first button write the following code to open and get the image.
OpenFileDialog1.InitialDirectory = "c:\"
OpenFileDialog1.Filter = "JPG|*.jpg|Bitmap|*.bmp"
Dim dialogresult As DialogResult = OpenFileDialog1.ShowDialog
If dialogresult = Windows.Forms.DialogResult.OK Then
PictureBox1.ImageLocation = OpenFileDialog1.FileName
btsetwallpaper.Enabled = True
End If
'In the click event of the second button write following code to set the wallpaper.
SetWallpaper(Me.PictureBox1.Image)
MessageBox.Show("Wallpaper has been changed", "Set Wallpaper", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
How to hide Windows Desktop and change desktop background color in c#?
By : Volodymyr Paprotski
Date : March 29 2020, 07:55 AM
Hope that helps Enumerate all desktop window with EnumWindows. Collect every visible window handle. Call ShowWindow with appropriate arguments to make the collected windows to be visible/invisible.
|
Will Flex (desktop browser) project export to AIR (desktop) seamlessly, or require tweaking?
By : samuel oyier
Date : March 29 2020, 07:55 AM
will help you The code will not 100% work. Off the top of my head the base class of a web-based Flex application is Application while an AIR-based Flex app will be WindowedApplication (EDIT: reading the docs this may not be strictly required as WindowedApplication inherits from Application). You'll also need to handle things like the application menu (and the fact that this menu is different on Mac and Windows) and situations like the user clicking the "x" close button on the app window.
|
Change desktop background in C#
By : Robo12
Date : March 29 2020, 07:55 AM
I wish did fix the issue. pvParam should be a local file. It will not work for urls... First download the image, then give its local path to SystemParametersInfo method. code :
var filename = "4.jpg";
new WebClient().DownloadFile("http://www.scottgames.com/4.jpg", filename);
SystemParametersInfo(SPI_SETDESKWALLPAPER, 1, filename, SPIF_UPDATEINIFILE);
|
MacOSX/Cocoa: how to change the desktop content view / how to draw directly on the desktop background?
By : Rishi Kumar Sharma
Date : March 29 2020, 07:55 AM
it fixes the issue Set a window's level as kCGDesktopWindowLevel and it will appear on top of the desktop picture but under the icons. You'll probably also want to tell the window to ignore mouse clicks unless you want to render portions of the desktop unclickable. (To clarify: I haven't checked, but I kind of doubt this is actually how the ScreenSaverEngine does its trick. Apple can mingle its apps with each other in ways that you can't — for example, many of the system-provided Menu Extras are half implemented in their .menu bundles and half in the SystemUIServer host process. But this technique gets the effect you're looking for.)
|