Feb 16th, 2005, 09:46 PM
#1
Thread Starter
Admodistrator
Change desktop.
Well ive got an idea, and id like to know how to change the desktop background thing...also refreshing every minute, would that take alot of resources?or freeze the comp?
Feb 16th, 2005, 10:15 PM
#2
Re: Change desktop.
Are you trying to make some kind of slide show using your desktop wallpaper?
Anything takes up resources, but it just depends on how you code it.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 16th, 2005, 10:28 PM
#3
Thread Starter
Admodistrator
Re: Change desktop.
no, im gonna put the time (now) and (date) and stuff over the desktop, like in a corner, and i want it to update whenever the time updates
Feb 16th, 2005, 10:29 PM
#4
Re: Change desktop.
Why not just create a borderless windowed app? Then you can have the background
transparent so you only see the numbers, etc?
Are you running 2000 or above?
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 16th, 2005, 10:32 PM
#5
Thread Starter
Admodistrator
Re: Change desktop.
well, i want to be able to put stuff over (icons)and still see it, and i want to be able to click the icons, is this possible?
ediT**
how about floating text, is that possible? nothing except text?
Feb 16th, 2005, 10:35 PM
#6
Re: Change desktop.
Floating text is possible if you are running Windows 2000 or above.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 16th, 2005, 10:35 PM
#7
Thread Starter
Admodistrator
Re: Change desktop.
sorry, yes i do have that..forgot to answer that one
Feb 16th, 2005, 10:42 PM
#8
Re: Change desktop.
This will make your form transparent to whatever level you want.
VB Code:
Option Explicit
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" _
(ByVal lpLibFileName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, _
ByVal lpProcName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, _
ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2
Public Sub AlphaBlendForm(ByVal lHwnd As Long, ByVal intTranslucenceLevel As Integer)
If APIExists("SetLayeredWindowAttributes", "User32") Then
SetWindowLong lHwnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes lHwnd, 0, intTranslucenceLevel, LWA_ALPHA
Else
MsgBox "Your OS does not support Alpha Blending.", vbExclamation, "Alpha Blend"
End If
End Sub
Public Function APIExists(ByVal pstrFunctionName As String, ByVal pstrDllName As String) As Boolean
Dim lngHandle As Long
Dim lngAddr As Long
lngHandle = LoadLibrary(pstrDllName)
If Not (lngHandle = 0) Then
lngAddr = GetProcAddress(lngHandle, pstrFunctionName)
FreeLibrary lngHandle
End If
APIExists = Not (lngAddr = 0)
End Function
Private Sub Form_Load()
'Form1.BorderStyle = 0 set this in design time properties window
AlphaBlendForm Me.hwnd, 128 'MAX VALUE = OPAIC/ MIN VALUE = 0 CAN'T SEE'
End Sub
Now we just need to cut out what we dont want to show.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 16th, 2005, 10:50 PM
#9
Re: Change desktop.
I think my code to cut out regions is at work. I'll connect and check.
This is the last part we need.
Be back in a few.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 16th, 2005, 10:53 PM
#10
Thread Starter
Admodistrator
Re: Change desktop.
got it to get the time, now all i need is so its clickable and formless, why dont i just make the form the size of the text box?
VB Code:
Option Explicit
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" _
(ByVal lpLibFileName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, _
ByVal lpProcName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, _
ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2
Public Sub AlphaBlendForm(ByVal lHwnd As Long, ByVal intTranslucenceLevel As Integer)
Form1.BorderStyle = 0
If APIExists("SetLayeredWindowAttributes", "User32") Then
SetWindowLong lHwnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes lHwnd, 0, intTranslucenceLevel, LWA_ALPHA
Else
MsgBox "Your OS does not support Alpha Blending.", vbExclamation, "Alpha Blend"
End If
End Sub
Public Function APIExists(ByVal pstrFunctionName As String, ByVal pstrDllName As String) As Boolean
Dim lngHandle As Long
Dim lngAddr As Long
lngHandle = LoadLibrary(pstrDllName)
If Not (lngHandle = 0) Then
lngAddr = GetProcAddress(lngHandle, pstrFunctionName)
FreeLibrary lngHandle
End If
APIExists = Not (lngAddr = 0)
End Function
Private Sub Form_Load()
Text1.Text = 5
'Form1.BorderStyle = 0 set this in design time properties window
AlphaBlendForm Me.hwnd, 30 'MAX VALUE = OPAIC/ MIN VALUE = 0 CAN'T SEE'
End Sub
Private Sub Text1_Change()
Text2.Text = Now
If Text1.Text < 0 Then
Text1.Text = 5
End If
End Sub
Private Sub Timer1_Timer()
Text1.Text = Val(Text1.Text) - 1
End Sub
Feb 16th, 2005, 11:00 PM
#11
Re: Change desktop.
The problem is that this method will make all controls and the form transparent. So we need to
create "regions" to tell windows that we dont want to use the areas and we release them
to windows. So if something is behind it you can actually click through it even though
your clock is on top of it.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 16th, 2005, 11:02 PM
#12
Thread Starter
Admodistrator
Re: Change desktop.
so it is possible?and another thing, how do i make it so a form isnt sizable?i cant find the cmd, is it also possible to get rid of the whole blue bar on top? i want it as small as possible? i can make my own form_unload inside the proggy
Feb 16th, 2005, 11:05 PM
#13
Re: Change desktop.
Yes its possible.
To make a form non-sizeable go to the design time properties window for the Forms props and change BorderStyle to 0 - None.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 16th, 2005, 11:15 PM
#14
Thread Starter
Admodistrator
Re: Change desktop.
hmm, tried this:
AlphaBlendForm Text1.BackColor, 20
doesnt work, it made the whole form invisible once, then didnt work anymore..ill work on this..
edit**
found out labels can be transparent, now to make the background transparent : )
Last edited by |2eM!x; Feb 16th, 2005 at 11:27 PM .
Feb 16th, 2005, 11:30 PM
#15
Re: Change desktop.
But you dont understand, all the controls will be the same transparency as the form.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 16th, 2005, 11:33 PM
#16
Thread Starter
Admodistrator
Re: Change desktop.
well, i thought the text box would still be white as a background and that the text would fade too, and i also thought that with the label that since i dont have a form(its the same size) that it would have a clear background, with letters?
i hope you get my gist..
now to look for a movewindow on click api, i had it before-dang
Feb 16th, 2005, 11:37 PM
#17
Re: Change desktop.
I almost got it complete. So you want the background of the textbox to be solid or transparent?
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 16th, 2005, 11:39 PM
#18
Thread Starter
Admodistrator
Re: Change desktop.
transparent, heres waht i have:
hope we are on the same page ; )
Attached Files
Feb 16th, 2005, 11:49 PM
#19
Re: Change desktop.
Here it is but the background of the textbox can not be made transparent
without loosing the digits visibility. A label will not be any better since it is
not a real transparent backcolor.
This is a screenshot of it on my desktop (clouds).
VB Code:
Option Explicit
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, _
ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, _
ByVal nCombineMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, _
ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
' Constants used by the CombineRgn function
Private Const RGN_AND = 1
Private Const RGN_OR = 2
Private Const RGN_XOR = 3
Private Const RGN_DIFF = 4
Private Const RGN_COPY = 5
Private Sub Form_Activate()
Dim rgnForm As Long, rgnCombined As Long
Dim rgnControl As Long, X As Long
Dim formWidth As Single, formHeight As Single
Dim borderWidth As Single, titleHeight As Single
Dim ctlLeft As Single, ctlTop As Single
Dim ctlWidth As Single, ctlHeight As Single
Dim ctl As Control
' Calculate the form area
borderWidth = (Me.Width - Me.ScaleWidth) / 2
titleHeight = Me.Height - Me.ScaleHeight - borderWidth
' Convert to Pixels
borderWidth = ScaleX(borderWidth, vbTwips, vbPixels)
titleHeight = ScaleY(titleHeight, vbTwips, vbPixels)
formWidth = ScaleX(Me.Width, vbTwips, vbPixels)
formHeight = ScaleY(Me.Height, vbTwips, vbPixels)
' Create a region for the whole form
rgnForm = CreateRectRgn(0, 0, formWidth, formHeight)
rgnCombined = CreateRectRgn(0, 0, 0, 0)
' Make the graphical area transparent by combining the two regions
X = CombineRgn(rgnCombined, rgnForm, rgnForm, RGN_DIFF)
' Make the controls visible
For Each ctl In Controls
' Make the regions of controls whose container is the form visible
If ctl.Name <> "Timer1" Then
If TypeOf ctl.Container Is Form Then
ctlLeft = ScaleX(ctl.Left, vbTwips, vbPixels) + borderWidth
ctlTop = ScaleX(ctl.Top, vbTwips, vbPixels) + titleHeight
ctlWidth = ScaleX(ctl.Width, vbTwips, vbPixels) + ctlLeft
ctlHeight = ScaleX(ctl.Height, vbTwips, vbPixels) + ctlTop
rgnControl = CreateRectRgn(ctlLeft, ctlTop, ctlWidth, ctlHeight)
X = CombineRgn(rgnCombined, rgnCombined, rgnControl, RGN_OR)
End If
End If
Next ctl
' Set the clipping area of the window using the resulting region
SetWindowRgn hWnd, rgnCombined, True
' Tidy up
X = DeleteObject(rgnCombined)
X = DeleteObject(rgnControl)
X = DeleteObject(rgnForm)
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
Timer1.Interval = 1000
Timer1.Enabled = True
Text1.Text = Format(Now, "MM/DD/YYYY hh:mm:ss AMPM")
End Sub
Private Sub Timer1_Timer()
Text1.Text = Format(Now, "MM/DD/YYYY hh:mm:ss AMPM")
End Sub
I hope this is what you were wanting.
Attached Images
Attached Files
Last edited by RobDog888; Feb 16th, 2005 at 11:54 PM .
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 17th, 2005, 12:00 AM
#20
Thread Starter
Admodistrator
Re: Change desktop.
Attached Files
Feb 17th, 2005, 12:03 AM
#21
Re: Change desktop.
I dont have WinRar. Could you upload a zip?
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Feb 17th, 2005, 04:44 PM
#22
Thread Starter
Admodistrator
Re: Change desktop.
yeah, sure..you should probably get winrar sometime-it compresses better, and can read winzip and stuff..i like it..
know just to make it click thru, except for the x box
Attached Files
Last edited by |2eM!x; Feb 17th, 2005 at 05:49 PM .
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width