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?
Printable View
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?
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.
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
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?
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?
Floating text is possible if you are running Windows 2000 or above.
sorry, yes i do have that..forgot to answer that one :blush:
This will make your form transparent to whatever level you want.
Now we just need to cut out what we dont want to show.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
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.
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
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.
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
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.
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 : )
But you dont understand, all the controls will be the same transparency as the form.
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
I almost got it complete. So you want the background of the textbox to be solid or transparent?
transparent, heres waht i have:
hope we are on the same page ; )
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).
http://www.vbforums.com/attachment.p...chmentid=34138
I hope this is what you were wanting.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
thanks, here it is
I dont have WinRar. Could you upload a zip?
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