Attribute VB_Name = "Actions"
'Simi-Transparent Objects...
Public Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hdc As Long) As Long
Public Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public Declare Function BitBlt Lib "GDI32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Const SRCCOPY = &HCC0020

'Prevents recursion
'Global iRecursion As Boolean
'Global tColor As Long

'Function Declares (Windows API)
Public Const RSP_SIMPLE_SERVICE = 1
Public Const RSP_UNREGISTER_SERVICE = 0
Public Const RGN_COPY = 5
Public Declare Function CreateRectRgn Lib "GDI32" (ByVal x1 As Long, ByVal y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function CreateRoundRectRgn Lib "GDI32" (ByVal x1 As Long, ByVal y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Public Declare Function CombineRgn Lib "GDI32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Public Declare Function DeleteObject Lib "GDI32" (ByVal hObject As Long) As Long
Public Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function ReleaseCapture Lib "user32" () As Long
Public Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Public Declare Function GetCurrentProcess Lib "kernel32" () As Long
Public Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Public Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long

'Private Declare Variables
Private HW As Long
Private HA As Long
Private iLeft As Integer
Private iTop As Integer
Private iWidth As Integer
Private iHeight As Integer

'Constants
#Const CASE_SENSITIVE_PASSWORD = False
Private Const StrPwd = "SLAMMED DESIGNS"

'Types Section
Public Type POINTAPI
   X As Long
   Y As Long
End Type
Public Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type


Public Sub SnapCursor(ByVal hWnd As Long)
    Dim lpRect As RECT
    GetWindowRect hWnd, lpRect
    SetCursorPos lpRect.Left + (lpRect.Right - lpRect.Left) \ 2, lpRect.Top + (lpRect.Bottom - lpRect.Top) \ 2
End Sub

Public Sub TrapCursor(Trapped As Boolean)
    Dim TrapedArea As RECT
    If Trapped = False Then
        GetWindowRect GetDesktopWindow, TrapedArea
    Else
        GetWindowRect PassBox.hWnd, TrapedArea
    End If
    Call ClipCursor(TrapedArea)
End Sub

Public Sub MakeNormal(OnTopFormName)
    Call TrapCursor(False)
    Call Desktop(True)
    Call TaskBar(True)
    Call DisableCtrlAltDelete(False)
    MakeTopMost (OnTopFormName)
End Sub

Sub DisableCtrlAltDelete(bDisabled As Boolean)
    Dim X As Long
    X = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub

Public Function EncryptText(strText As String)
Dim i As Integer, c As Integer
Dim strBuff As String

#If Not CASE_SENSITIVE_PASSWORD Then

'Convert password to upper case
'if not case-sensitive


#End If

'Encrypt string
If Len(StrPwd) Then
  For i = 1 To Len(strText)
  c = Asc(Mid$(strText, i, 1))
  c = c + Asc(Mid$(StrPwd, (i Mod Len(StrPwd)) + 1, 1))
  strBuff = strBuff & Chr$(c And &HFF)
  Next i
Else
  strBuff = strText
End If

EncryptText = strBuff

End Function

'Decrypt text encrypted with EncryptText
Public Function DecryptText(strText As String)
Dim i As Integer, c As Integer
Dim strBuff As String

#If Not CASE_SENSITIVE_PASSWORD Then

'Convert password to upper case
'if not case-sensitive

#End If

'Decrypt string
If Len(StrPwd) Then
For i = 1 To Len(strText)
c = Asc(Mid$(strText, i, 1))
c = c - Asc(Mid$(StrPwd, (i Mod Len(StrPwd)) + 1, 1))
strBuff = strBuff & Chr$(c And &HFF)
Next i
Else
strBuff = strText
End If
DecryptText = strBuff
End Function

Public Sub MakeTranslucent(TheForm As Form, Optional tColor As Long)
    For RefreshImage = 1 To 2
        On Local Error Resume Next
        Dim HW As Long
        Dim HA As Long
        Dim iLeft As Integer
        Dim iTop As Integer
        Dim iWidth As Integer
        Dim iHeight As Integer
        WindowTentVal = GetOption("WindowTent", 100)
        If IsMissing(tColor) Or tColor = 0 Then
            tColor = RGB(WindowTentVal, WindowTentVal, WindowTentVal)
        End If
    
        TheForm.AutoRedraw = True
            
        TheForm.Hide
        
        DoEvents
    
        HW = GetDesktopWindow()
        HA = GetDC(HW)
    
        'Get the Left, Top, Width and Height of the Form...
        iLeft = TheForm.Left / Screen.TwipsPerPixelX
        iTop = TheForm.Top / Screen.TwipsPerPixelY
        iWidth = TheForm.ScaleWidth
        iHeight = TheForm.ScaleHeight
    
        'Transfer the contents of the Desktop Window to the Form...
        Call BitBlt(TheForm.hdc, 0, 0, iWidth, iHeight, HA, iLeft, iTop, SRCCOPY)
    
        'Show...
        TheForm.Picture = TheForm.Image
        
        TheForm.Show

        'Release the DC...
        Call ReleaseDC(HW, HA)
    
        'Add color...
        TheForm.DrawMode = 9
        TheForm.ForeColor = tColor
        TheForm.Line (0, 0)-(iWidth, iHeight), , BF
    Next RefreshImage
End Sub


Public Sub LockWindow(hWnd As Long)
    LockWindowUpdate hWnd
End Sub

Public Sub UnlockWindow()
    LockWindowUpdate 0
End Sub

Public Function GetOption(Setting, Default)
GetOption = GetSetting("Windows", "Startup", Setting, Default)
End Function
Public Function SaveOption(Setting, Value)
SaveSetting "Windows", "Startup", Setting, Value
End Function

