This may do the trick (if you have Win 2K or above). Place a timer on the Form.
(Modified original code posted by RobDog888)
VB Code:
Option Explicit 'Note: Win 2K + 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 Private mlHwnd As Long Private Sub Form_Load() Timer1.Interval = 100 Timer1.Enabled = True AlphaBlendForm Me.hwnd, 0 'MAX VALUE = OPAIC/ MIN VALUE = 0 CANT SEE End Sub Private 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 Private 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 Timer1_Timer() Static intIdx As Integer AlphaBlendForm Me.hwnd, intIdx 'Increment the Index counter If intIdx >= 255 Then Timer1.Enabled = False Else intIdx = intIdx + 5 End If End Sub
Bruce.




Reply With Quote