What am I missing? (forms fade in fade out)

I need help with this, I can't seem to find out what i'm missing in my vb code!
I got this code from a friend and I don't know whats wrong with it!
It keeps saying that "dummy" is not a expected varible or prosedure, but when I change it to "dummy.*" it says for me to remove the ()
I don't know what to do!
anyway, heres the code...

This goes in the form...

Private Sub Form_Load()
' DROPSHADOW Win2000/XP
ApplyDropShadow Me.hwnd
'FULLY TRANSLUCENT ON WIN 2000/XP
dummy = TranslucentForm(Me, 0)
'FADING IN
For i = 0 To 255 Step 5
dummy = TranslucentForm(Me, CByte(i))
DoEvents
Me.Show
Next
'FULLY OPAQUE
dummy = TranslucentForm(Me, 255)
End Sub

This goes in a module witch I do not know what to name it...

Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2
Private Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex 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
Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Declare Function GetClassLong Lib "user32.dll" Alias "GetClassLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long

Public Sub ApplyDropShadow(hwnd As Long)
On Error Resume Next
SetClassLong hwnd, -26, GetClassLong(hwnd, -26) Or &H20000
End Sub

Public Function TranslucentForm(frm As Form, _
TranslucenceLevel As Byte) As Boolean
On Error Resume Next
SetWindowLong frm.hwnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes frm.hwnd, 0, TranslucenceLevel, _
LWA_ALPHA
TranslucentForm = Err.LastDllError = 0
End Function
chrisyroidAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
You're not using the return value of TranslucentForm() so I would get rid of the "dummy" variable...

Change:

    dummy = TranslucentForm(Me, 0)

to:

    TranslucentForm Me, 0

Follow the pattern to change the other to calls to TranslucentForm() as well.

0
chrisyroidAuthor Commented:
the form is fading in too fast, is there anyway to change that?
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
You could make a call to the Sleep() API to slow down your loop:

Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

...

    For i = 0 To 255 Step 5
        dummy = TranslucentForm(Me, CByte(i))
        DoEvents
        Me.Show
        Sleep 25
    Next
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

chrisyroidAuthor Commented:
could I hook it up to a timer?
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
Sure...something like...

' --------------------
'   Form1
' --------------------
Option Explicit

Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
    (ByVal hWnd As Long, ByVal nIndex 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 Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" _
    (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
   
Private Declare Function GetClassLong Lib "user32.dll" Alias "GetClassLongA" _
    (ByVal hWnd As Long, ByVal nIndex As Long) As Long

Private alpha As Integer

Private Sub Form_Load()
    Timer1.Enabled = False
    alpha = 1
    Timer1.Interval = 15
   
    ' DROPSHADOW Win2000/XP
    ApplyDropShadow Me
    'FULLY TRANSLUCENT ON WIN 2000/XP
    TranslucentForm Me, 0
   
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    If alpha < 255 Then
        alpha = alpha + 2
        TranslucentForm Me, CByte(alpha)
    Else
        Timer1.Enabled = False
        TranslucentForm Me, 255
    End If
End Sub

Private Sub ApplyDropShadow(frm As Form)
    On Error Resume Next
    SetClassLong frm.hWnd, -26, GetClassLong(frm.hWnd, -26) Or &H20000
End Sub

Private Sub TranslucentForm(frm As Form, TranslucenceLevel As Byte)
    On Error Resume Next
    SetWindowLong frm.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
    SetLayeredWindowAttributes frm.hWnd, 0, TranslucenceLevel, LWA_ALPHA
End Sub
0
chrisyroidAuthor Commented:
thanks. please close this
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
Close it by clicking the "Accept" button next to the comment that answered your question...   =)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.