GFLEDBox/GFLEDBoxmod.bas

Attribute VB_Name = "GFLEDBoxmod"
Option Explicit
'(c)2001 by Louis.
'Animation_Start
Private Declare Function CreateThread Lib "kernel32" (lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal dwStackSize As LongByVal lpStartAddress As Long, lpParameter As AnyByVal dwCreationFlags As Long, lpThreadId As Long) As Long
Private Declare Sub ExitThread Lib "kernel32" (ByVal dwExitCode As Long)
'Animation_Start
Private Type SECURITY_ATTRIBUTES
    nLength As Long
    lpSecurityDescriptor As Long
    bInheritHandle As Long
End Type
'other
Dim AnimationThreadID As Long
Public Animation_StopFlag As Boolean

Public Sub Animation_Start()
    'on error resume next
    Dim SECURITY_ATTRIBUTESVar As SECURITY_ATTRIBUTES
    'verify
    If Not (AnimationThreadID = 0) Then Exit Sub 'avoid creating two threads
    'preset
    SECURITY_ATTRIBUTESVar.nLength = Len(SECURITY_ATTRIBUTESVar)
    'reset
    Animation_StopFlag = False 'reset
    'begin
    Call CreateThread(SECURITY_ATTRIBUTESVar, 0, AddressOf Animation_StartSub, 0&, 0, AnimationThreadID)
End Sub

Public Function Animation_StartSub(ByVal lParam As Long) As Long
    'on error resume next
    Call GFLEDBoxfrm.Animation_Loop
    Call ExitThread(0)
End Function

Public Sub Animation_Stop()
    'on error resume next
    Animation_StopFlag = True
    AnimationThreadID = 0 'reset
End Sub


[END OF FILE]