vbAccelerator - Contents of code file: mMain.bas

Attribute VB_Name = "mMain"
Option Explicit

Public g_cSB As cSpriteBitmaps
Public g_cSBA As cSpriteBitmaps
Public g_cSBs As cSpriteBitmaps
Public g_cSBsA As cSpriteBitmaps
Public g_iSpriteNum As Long
Public g_iProportion As Long
Public g_lIdiocy As Long

Private m_sGold As String
Private m_sGoldAction As String
Private m_sPurple As String
Private m_sPurpleAction As String
Public g_sBackdrop As String
Public Enum ERunModes
    ePreview
    eScreenSave
End Enum

Public g_eRunMode As ERunModes

Public Sub Main()
Dim Handle As Long
Dim iPos As Long

    If (App.PrevInstance) Then
        End
    End If

    ' Get settings:
    Loadsettings

    ' Create a sprite bitmap graphic source:
    Set g_cSB = New cSpriteBitmaps
    Dim oPic As StdPicture
    Set oPic = LoadPicture(m_sGold)
    g_cSB.CreateFromPicture oPic, 7, 5, , RGB(0, 255, 0)
    Set g_cSBA = New cSpriteBitmaps
    Set oPic = LoadPicture(m_sGoldAction)
    g_cSBA.CreateFromPicture oPic, 7, 5, , RGB(0, 255, 0)
    Set g_cSBs = New cSpriteBitmaps
    Set oPic = LoadPicture(m_sPurple)
    g_cSBs.CreateFromPicture oPic, 7, 5, , RGB(0, 255, 0)
    Set g_cSBsA = New cSpriteBitmaps
    Set oPic = LoadPicture(m_sPurpleAction)
    g_cSBsA.CreateFromPicture oPic, 7, 5, , RGB(0, 255, 0)
        
    iPos = InStr(LCase$(Command), "/p/index.html")
    If (iPos <> 0) Then
        ' preview mode. We have an extra parameter:
        Handle = CLng(Trim$(Mid$(Command, iPos + 3)))
        pShowPreview Handle
    Else
        If InStr(LCase$(Command), "/c/index.html") <> 0 Then
            ' configure:
            frmOptions.Show
        Else
            ' run:
            g_eRunMode = eScreenSave
            frmSSaver.Show
        End If
    End If
    
End Sub

Public Sub pShowPreview( _
        ByVal hwnd As Long _
    )
Dim tR As RECT
    '- Run the screen saver in the windows preview dialog (? possibly...)
    g_eRunMode = ePreview                    ' Store screen saver's run mode...
            
    frmSSaver.PreviewhWnd = hwnd
    frmSSaver.Show
    
End Sub

Public Sub Loadsettings()
    
    m_sGold = App.Path & "/home/VB/Code/vbMedia/Transparent_GDI_Sprite_Library/gold_big_blob.gif"
    m_sGoldAction = App.Path & "/home/VB/Code/vbMedia/Transparent_GDI_Sprite_Library/gold_big_blob_action.gif"
    m_sPurple = App.Path & "/home/VB/Code/vbMedia/Transparent_GDI_Sprite_Library/purple_big_blob.gif"
    m_sPurpleAction = App.Path & "/home/VB/Code/vbMedia/Transparent_GDI_Sprite_Library/purple_big_blob_action.gif"
    g_sBackdrop = App.Path & "/home/VB/Code/vbMedia/Transparent_GDI_Sprite_Library/backdrop.jpg"
    
    Dim cR As New cRegistry
    cR.ClassKey = HKEY_CURRENT_USER
    cR.SectionKey = "Software\vbaccelerator\Blob Saver"
    cR.ValueKey = "Idiocy"
    If (cR.KeyExists) Then
        cR.ValueType = REG_DWORD
        cR.ValueKey = "Idiocy"
        g_lIdiocy = cR.Value
        cR.ValueKey = "Proportion"
        g_iProportion = cR.Value
        cR.ValueKey = "Number"
        g_iSpriteNum = cR.Value
        
        cR.ValueType = REG_SZ
        cR.Default = "!Default!"
        
        cR.ValueKey = "GoldSpriteBitmap"
        If (cR.Value <> cR.Default) Then
            m_sGold = cR.Value
        Else
            cR.Value = m_sGold
        End If
        cR.ValueKey = "GoldActionSpriteBitmap"
        If (cR.Value <> cR.Default) Then
            m_sGoldAction = cR.Value
        Else
            cR.Value = m_sGoldAction
        End If
        cR.ValueKey = "PurpleSpriteBitmap"
        If (cR.Value <> cR.Default) Then
            m_sPurple = cR.Value
        Else
            cR.Value = m_sPurple
        End If
        cR.ValueKey = "PurpleActionSpriteBitmap"
        If (cR.Value <> cR.Default) Then
            m_sPurpleAction = cR.Value
        Else
            cR.Value = m_sPurpleAction
        End If
        
        cR.ValueKey = "BackdropBitmap"
        If (cR.Value <> cR.Default) Then
            g_sBackdrop = cR.Value
        Else
            cR.Value = g_sBackdrop
        End If

    Else
        g_lIdiocy = 20
        g_iProportion = 33
        g_iSpriteNum = 16
    End If
End Sub