Projects

Find all our projects in development below.
All source code is GNU General Public License (GPL)

Red Dot App Ex

Browsing MainMod.bas (21.61 KB)

Attribute VB_Name = "MainMod"

Private Const GWL_WNDPROC = (-4)
Private Const WM_DISPLAYCHANGE = &H7E
Private Const WM_HOTKEY = &H312
Private Const WM_TIMER = &H113

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private AppWnd As Long

Private ScreenWidth As Long
Private ScreenHeight As Long

Private DrawColors(3, 15) As Long
Private DrawColorsIndex0 As Integer
Private DrawColorsIndex1 As Integer
Private DrawColorsInc As Integer
Private DrawColorsDelay As Integer
Private Const DrawColorsDelayCount = 2
Private DrawRectV(2) As RECT
Private DrawRectH(2) As RECT
Private DrawRectIndex As Integer

Private bMouseLastDown As Boolean

Private DrawFont As Long
Private DrawFontRect As RECT

Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hDC As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Declare Function FillRect Lib "user32" (ByVal hDC As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (ByVal hDC As Long, ByVal lpsz As String, ByVal cbString As Long, lpSize As SIZE) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hgdiobj As Long) As Long
Private Declare Function SetBkColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long
Private Declare Function SetBkMode Lib "gdi32" (ByVal hDC As Long, ByVal nBkMode As Long) As Long
Private Declare Function SetTextColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long

Private Type SIZE
    cx As Long
    cy As Long
End Type

Private Const TRANSPARENT = 1
Private Const OPAQUE = 2

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Declare Function GlobalAddAtom Lib "kernel32" Alias "GlobalAddAtomA" (ByVal lpString As String) As Integer
Private Declare Function GlobalDeleteAtom Lib "kernel32" (ByVal nAtom As Integer) As Integer

Private Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Private Const DrawRedDotTimerID = 100
Private iDrawRedDotTimer As Long
Private Const DrawClockTimerID = 200
Private iDrawClockTimer As Long

Private Declare Sub PostQuitMessage Lib "user32" (ByVal nExitCode As Long)
Private Declare Function RegisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long
Private Declare Function UnregisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long) As Long

Private Const MOD_ALT = &H1
Private Const MOD_CONTROL = &H2
Private Const MOD_SHIFT = &H4
Private Const MOD_WIN = &H8

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Private Const KEY_F1 = 112
Private Const KEY_F2 = 113
Private Const KEY_F3 = 114
Private Const KEY_F4 = 115
Private Const KEY_F5 = 116
Private Const KEY_F6 = 117
Private Const KEY_F7 = 118
Private Const KEY_F8 = 119

Private Const KEY_MOUSE1 = 1

Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam 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 PrevWindowProc As Long

Private iAtom_SmallRedDot As Long
Private iAtom_MedRedDot As Long
Private iAtom_LargeRedDot As Long
Private iAtom_NoRedDot As Long
Private iAtom_TerminateRedDot As Long

Private iAtom_FadeBlack As Long
Private iAtom_FadeGreen As Long
Private iAtom_FadeYellow As Long
Private iAtom_FadeBlue As Long

Private iAtom_ShowClock As Long
Private iAtom_ShowOptions As Long

Private iAtom_TerminateHL As Long

Private Const LF_FACESIZE = 32
Private Type LOGFONT
    lfHeight As Long
    lfWidth As Long
    lfEscapement As Long
    lfOrientation As Long
    lfWeight As Long
    lfItalic As Byte
    lfUnderline As Byte
    lfStrikeOut As Byte
    lfCharSet As Byte
    lfOutPrecision As Byte
    lfClipPrecision As Byte
    lfQuality As Byte
    lfPitchAndFamily As Byte
    lfFaceName(LF_FACESIZE) As Byte
End Type
Private Const FW_NORMAL = 400
Private Const FW_BOLD = 700

Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Private Declare Function MulDiv Lib "kernel32" (ByVal nNumber As Long, ByVal nNumerator As Long, ByVal nDenominator As Long) As Long
Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex As Long) As Long
Private Const LOGPIXELSY = 90

Private Const MAX_PATH = 260
Private Const TH32CS_SNAPPROCESS = &H2
Private Const PROCESS_TERMINATE = &H1

Private Type PROCESSENTRY32
    dwSize As Long
    cntUsage As Long
    th32ProcessID As Long
    th32DefaultHeapID As Long
    th32ModuleID As Long
    cntThreads As Long
    th32ParentProcessID As Long
    pcPriClassBase As Long
    dwFlags As Long
    szExeFile As String * MAX_PATH
End Type

Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, lProcessID As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal blnheritHandle As Long, ByVal dwAppProcessId As Long) As Long
Private Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal ApphProcess As Long, ByVal uExitCode As Long) As Long

Public Const RegAppRoot = "Software\RedDotAppEx\"

Private Type CLOCKFONT
    Name As String
    SIZE As Single
    Bold As Boolean
    Italic As Boolean
    Underline As Boolean
    Strikethru As Boolean
    TextColor As Long
    BackColor As Long
    BackTransparent As Boolean
End Type

Public Optn_Font As CLOCKFONT
Public Optn_ClockX As Long
Public Optn_ClockY As Long
Public Optn_DefDotSize As Integer

Private Function EndProcess(ProcessID As Long) As Long
Dim hProcess As Long
Dim lExitCode As Long
    hProcess = OpenProcess(PROCESS_TERMINATE, 0&, ProcessID)
    If hProcess Then EndProcess = TerminateProcess(hProcess, lExitCode)
End Function


Private Sub TerminateProcessByName(szName As String)
Dim uProcess As PROCESSENTRY32
Dim rProcess As Long
Dim hSnapshot As Long
Dim sProcessName As String
Dim lProcessID As Long
    hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
    If hSnapshot Then
        uProcess.dwSize = Len(uProcess)
        rProcess = ProcessFirst(hSnapshot, uProcess)
        Do While rProcess
           sProcessName = IIf(InStr(uProcess.szExeFile, Chr(0)), Left(uProcess.szExeFile, InStr(uProcess.szExeFile, Chr(0)) - 1), uProcess.szExeFile)
           lProcessID = uProcess.th32ProcessID
           If LCase(sProcessName) = LCase(szName) Then Exit Do
           rProcess = ProcessNext(hSnapshot, uProcess)
        Loop
        CloseHandle hSnapshot
        If LCase(sProcessName) = LCase(szName) Then EndProcess lProcessID
    End If
End Sub
Sub CreateColorsArray()
Dim i As Integer
    For i = 0 To 15
        DrawColors(0, i) = RGB(i * 16, 0, 0)
    Next i
    For i = 0 To 15
        DrawColors(1, i) = RGB(i * 16, ((16 - i) * 16) - 1, 0)
    Next i
    For i = 0 To 15
        DrawColors(2, i) = RGB(255, ((16 - i) * 16) - 1, 0)
    Next i
    For i = 0 To 15
        DrawColors(3, i) = RGB(256 - ((16 - i) * 16), ((16 - i) * 16) - 1, ((16 - i) * 16) - 1)
    Next i
End Sub


Public Sub InitClockDrawing()
Dim ClockLogFont As LOGFONT
    If DrawFont Then DeleteObject DrawFont
    ClockFontToLogFont Optn_Font, GetDC(0), ClockLogFont
    DrawFont = CreateFontIndirect(ClockLogFont)
End Sub

Private Sub SetDrawRects()
    DrawRectV(0) = SetRect((ScreenWidth / 2) - 2, (ScreenHeight / 2) - 1, (ScreenWidth / 2) + 2, (ScreenHeight / 2) + 1, True)
    DrawRectH(0) = SetRect((ScreenWidth / 2) - 1, (ScreenHeight / 2) - 2, (ScreenWidth / 2) + 1, (ScreenHeight / 2) + 2, True)
    DrawRectV(1) = SetRect((ScreenWidth / 2) - 3, (ScreenHeight / 2) - 2, (ScreenWidth / 2) + 3, (ScreenHeight / 2) + 2, True)
    DrawRectH(1) = SetRect((ScreenWidth / 2) - 2, (ScreenHeight / 2) - 3, (ScreenWidth / 2) + 2, (ScreenHeight / 2) + 3, True)
    DrawRectV(2) = SetRect((ScreenWidth / 2) - 4, (ScreenHeight / 2) - 3, (ScreenWidth / 2) + 4, (ScreenHeight / 2) + 3, True)
    DrawRectH(2) = SetRect((ScreenWidth / 2) - 3, (ScreenHeight / 2) - 4, (ScreenWidth / 2) + 3, (ScreenHeight / 2) + 4, True)
End Sub


Private Function WindowProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
On Error Resume Next
Dim ScreenDC As Long
Dim DrawBrush As Long
    If hWnd = AppWnd Then
        If uMsg = WM_HOTKEY Then
            Select Case wParam
                Case iAtom_SmallRedDot
                    DrawRectIndex = 0
                    If iDrawRedDotTimer = 0 Then iDrawRedDotTimer = SetTimer(AppWnd, DrawRedDotTimerID, 1, 0)
                Case iAtom_MedRedDot
                    DrawRectIndex = 1
                    If iDrawRedDotTimer = 0 Then iDrawRedDotTimer = SetTimer(AppWnd, DrawRedDotTimerID, 1, 0)
                Case iAtom_LargeRedDot
                    DrawRectIndex = 2
                    If iDrawRedDotTimer = 0 Then iDrawRedDotTimer = SetTimer(AppWnd, DrawRedDotTimerID, 1, 0)
                Case iAtom_NoRedDot
                    If iDrawRedDotTimer Then
                        iDrawRedDotTimer = KillTimer(AppWnd, DrawRedDotTimerID)
                        iDrawRedDotTimer = 0
                    End If
                Case iAtom_TerminateRedDot
                    UnSubclass
                    UnregisterHotkeys
                    PostQuitMessage 0&
                Case iAtom_FadeBlack
                    DrawColorsIndex0 = 0
                Case iAtom_FadeGreen
                    DrawColorsIndex0 = 1
                Case iAtom_FadeYellow
                    DrawColorsIndex0 = 2
                Case iAtom_FadeBlue
                    DrawColorsIndex0 = 3
                Case iAtom_ShowClock
                    If iDrawClockTimer Then
                        iDrawClockTimer = KillTimer(AppWnd, DrawClockTimerID)
                        iDrawClockTimer = 0
                    Else
                        iDrawClockTimer = SetTimer(AppWnd, DrawClockTimerID, 1, 0)
                    End If
                Case iAtom_ShowOptions
                    OptionsForm.Show
                    OptionsForm.WindowState = vbNormal
                Case iAtom_TerminateHL
                    TerminateProcessByName "hl.exe"
                    TerminateProcessByName "cstrike.exe"
            End Select
        ElseIf uMsg = WM_DISPLAYCHANGE Then
            ScreenWidth = LoWord(lParam)
            ScreenHeight = HiWord(lParam)
            SetDrawRects
        ElseIf uMsg = WM_TIMER Then
            Select Case wParam
                Case DrawRedDotTimerID
                    ScreenDC = GetDC(0)
                    DrawBrush = CreateSolidBrush(DrawColors(DrawColorsIndex0, DrawColorsIndex1))
                    FillRect ScreenDC, DrawRectV(DrawRectIndex), DrawBrush
                    FillRect ScreenDC, DrawRectH(DrawRectIndex), DrawBrush
                    DeleteObject DrawBrush
                    ReleaseDC 0, ScreenDC
                    If GetAsyncKeyState(KEY_MOUSE1) <= -1 Then
                        bMouseLastDown = True
                    ElseIf GetAsyncKeyState(KEY_MOUSE1) = 0 And bMouseLastDown = True Then
                        bMouseLastDown = False
                        DrawColorsInc = -1
                        DrawColorsIndex1 = 15
                    End If
                    If bMouseLastDown Then
                        DrawColorsDelay = DrawColorsDelay + 1
                        If DrawColorsDelay > DrawColorsDelayCount Then
                            DrawColorsDelay = 0
                            DrawColorsIndex1 = DrawColorsIndex1 + DrawColorsInc
                            If DrawColorsIndex1 > 15 Then
                                DrawColorsInc = -1
                                DrawColorsIndex1 = 14
                            End If
                            If DrawColorsIndex1 < 0 Then
                                DrawColorsInc = 1
                                DrawColorsIndex1 = 1
                            End If
                        End If
                    End If
                Case DrawClockTimerID
                    Dim TextSize As SIZE
                    Dim OldDrawFont As Long
                    Dim DrawStr As String
                    ScreenDC = GetDC(0)
                    DrawStr = Str(Time)
                    If Optn_Font.BackTransparent = True Then
                        SetBkMode ScreenDC, TRANSPARENT
                    Else
                        SetBkMode ScreenDC, OPAQUE
                    End If
                    SetBkColor ScreenDC, Optn_Font.BackColor
                    SetTextColor ScreenDC, Optn_Font.TextColor
                    OldDrawFont = SelectObject(ScreenDC, DrawFont)
                    GetTextExtentPoint32 ScreenDC, DrawStr, Len(DrawStr), TextSize
                    DrawFontRect = SetRect(Optn_ClockX, Optn_ClockY, TextSize.cx + 10, TextSize.cy + 10)
                    DrawText ScreenDC, DrawStr, -1, DrawFontRect, 0
                    DeleteObject OldDrawFont
                    ReleaseDC 0, ScreenDC
            End Select
        End If
    End If
    WindowProc = CallWindowProc(PrevWindowProc, hWnd, uMsg, wParam, lParam)
End Function

Private Sub ClockFontToLogFont(fntThis As CLOCKFONT, hDC As Long, tLF As LOGFONT)
Dim sFont As String
Dim iChar As Integer
    With tLF
        sFont = fntThis.Name
        For iChar = 1 To Len(sFont)
            .lfFaceName(iChar - 1) = CByte(Asc(Mid(sFont, iChar, 1)))
        Next iChar
        .lfHeight = -MulDiv((fntThis.SIZE), (GetDeviceCaps(hDC, LOGPIXELSY)), 72)
        .lfItalic = fntThis.Italic
        If (fntThis.Bold) Then
            .lfWeight = FW_BOLD
        Else
            .lfWeight = FW_NORMAL
        End If
        .lfUnderline = fntThis.Underline
        .lfStrikeOut = fntThis.Strikethru
    End With
End Sub
Private Function HiWord(wParam As Long) As Long
    HiWord = wParam \ &H10000 And &HFFFF
End Function

Private Function LoWord(wParam As Long) As Long
    If wParam And &H8000& Then
        LoWord = &H8000& Or (wParam And &H7FFF&)
    Else
        LoWord = wParam And &HFFFF&
    End If
End Function

Private Function SetRect(ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, Optional bNoCalc As Boolean) As RECT
    SetRect.Left = X
    SetRect.Top = Y
    If bNoCalc = False Then
        SetRect.Right = X + cx
        SetRect.Bottom = Y + cy
    Else
        SetRect.Right = cx
        SetRect.Bottom = cy
    End If
End Function

Public Sub UnSubclass()
    If iDrawRedDotTimer Then iDrawRedDotTimer = KillTimer(AppWnd, DrawRedDotTimerID)
    If iDrawClockTimer Then iDrawClockTimer = KillTimer(AppWnd, DrawClockTimerID)
    DeleteObject DrawFont
    SetWindowLong AppWnd, GWL_WNDPROC, PrevWindowProc
End Sub

Public Sub UnregisterHotkeys()
    UnregisterHotKey AppWnd, iAtom_SmallRedDot
    GlobalDeleteAtom iAtom_SmallRedDot
    UnregisterHotKey AppWnd, iAtom_MedRedDot
    GlobalDeleteAtom iAtom_MedRedDot
    UnregisterHotKey AppWnd, iAtom_LargeRedDot
    GlobalDeleteAtom iAtom_LargeRedDot
    UnregisterHotKey AppWnd, iAtom_NoRedDot
    GlobalDeleteAtom iAtom_NoRedDot
    UnregisterHotKey AppWnd, iAtom_TerminateRedDot
    GlobalDeleteAtom iAtom_TerminateRedDot
    UnregisterHotKey AppWnd, iAtom_FadeBlack
    GlobalDeleteAtom iAtom_FadeBlack
    UnregisterHotKey AppWnd, iAtom_FadeGreen
    GlobalDeleteAtom iAtom_FadeGreen
    UnregisterHotKey AppWnd, iAtom_FadeYellow
    GlobalDeleteAtom iAtom_FadeYellow
    UnregisterHotKey AppWnd, iAtom_FadeBlue
    GlobalDeleteAtom iAtom_FadeBlue
    UnregisterHotKey AppWnd, iAtom_ShowClock
    GlobalDeleteAtom iAtom_ShowClock
    UnregisterHotKey AppWnd, iAtom_ShowOptions
    GlobalDeleteAtom iAtom_ShowOptions
    UnregisterHotKey AppWnd, iAtom_TerminateHL
    GlobalDeleteAtom iAtom_TerminateHL
End Sub

Sub Main()
Dim bRegErr As Boolean
Dim lRegData As Long
    If App.PrevInstance Then
        MsgBox "RedDotAppEx is already running.", vbInformation
        End
    End If
    Load DrawForm
    AppWnd = FindWindow("ThunderRT6Main", App.Title)
    If AppWnd = 0 Then
        MsgBox "An error occurred while initializing RedDotAppEx.", vbCritical
        End
    End If
    ScreenWidth = Int(Screen.Width / Screen.TwipsPerPixelY)
    ScreenHeight = Int(Screen.Height / Screen.TwipsPerPixelY)
    SetDrawRects
    DrawRectIndex = 1
    CreateColorsArray
    DrawColorsIndex0 = 2
    DrawColorsIndex1 = 15
    DrawColorsInc = -1
    DrawColorsDelay = 0
    iAtom_SmallRedDot = GlobalAddAtom("SmallRedDot Hotkey")
    RegisterHotKey AppWnd, iAtom_SmallRedDot, MOD_SHIFT, KEY_F1
    iAtom_MedRedDot = GlobalAddAtom("MedRedDot Hotkey")
    RegisterHotKey AppWnd, iAtom_MedRedDot, MOD_SHIFT, KEY_F2
    iAtom_LargeRedDot = GlobalAddAtom("LargeRedDot Hotkey")
    RegisterHotKey AppWnd, iAtom_LargeRedDot, MOD_SHIFT, KEY_F3
    iAtom_NoRedDot = GlobalAddAtom("NoRedDot Hotkey")
    RegisterHotKey AppWnd, iAtom_NoRedDot, MOD_SHIFT, KEY_F4
    iAtom_TerminateRedDot = GlobalAddAtom("TerminateRedDot Hotkey")
    RegisterHotKey AppWnd, iAtom_TerminateRedDot, MOD_SHIFT Or MOD_CONTROL, KEY_F4
    iAtom_FadeBlack = GlobalAddAtom("FadeBlack Hotkey")
    RegisterHotKey AppWnd, iAtom_FadeBlack, MOD_SHIFT, KEY_F5
    iAtom_FadeGreen = GlobalAddAtom("FadeGreen Hotkey")
    RegisterHotKey AppWnd, iAtom_FadeGreen, MOD_SHIFT, KEY_F6
    iAtom_FadeYellow = GlobalAddAtom("FadeYellow Hotkey")
    RegisterHotKey AppWnd, iAtom_FadeYellow, MOD_SHIFT, KEY_F7
    iAtom_FadeBlue = GlobalAddAtom("FadeBlue Hotkey")
    RegisterHotKey AppWnd, iAtom_FadeBlue, MOD_SHIFT, KEY_F8
    iAtom_ShowClock = GlobalAddAtom("ShowClock Hotkey")
    RegisterHotKey AppWnd, iAtom_ShowClock, MOD_CONTROL, vbKeyTab
    iAtom_ShowOptions = GlobalAddAtom("ShowOptions Hotkey")
    RegisterHotKey AppWnd, iAtom_ShowOptions, MOD_CONTROL Or MOD_SHIFT, vbKeyZ
    iAtom_TerminateHL = GlobalAddAtom("TerminateHL Hotkey")
    RegisterHotKey AppWnd, iAtom_TerminateHL, MOD_CONTROL Or MOD_SHIFT, vbKeyP
    Optn_Font.Name = GetRegString(HKEY_LOCAL_MACHINE, RegAppRoot, "Font.Name")
    If Optn_Font.Name = "" Then Optn_Font.Name = "Verdana"
    lRegData = GetRegDWORD(HKEY_LOCAL_MACHINE, RegAppRoot, "Font.Size", bRegErr)
    If (lRegData < 8 Or lRegData > 32) Or bRegErr Then lRegData = 10
    Optn_Font.SIZE = CSng(lRegData)
    lRegData = GetRegDWORD(HKEY_LOCAL_MACHINE, RegAppRoot, "Font.Bold", bRegErr)
    If (lRegData < 0 Or lRegData > 1) Or bRegErr Then lRegData = 1
    Optn_Font.Bold = CBool(lRegData)
    lRegData = GetRegDWORD(HKEY_LOCAL_MACHINE, RegAppRoot, "Font.Italic", bRegErr)
    If (lRegData < 0 Or lRegData > 1) Or bRegErr Then lRegData = 0
    Optn_Font.Italic = CBool(lRegData)
    lRegData = GetRegDWORD(HKEY_LOCAL_MACHINE, RegAppRoot, "Font.Underline", bRegErr)
    If (lRegData < 0 Or lRegData > 1) Or bRegErr Then lRegData = 0
    Optn_Font.Underline = CBool(lRegData)
    lRegData = GetRegDWORD(HKEY_LOCAL_MACHINE, RegAppRoot, "Font.Strikethru", bRegErr)
    If (lRegData < 0 Or lRegData > 1) Or bRegErr Then lRegData = 0
    Optn_Font.Strikethru = CBool(lRegData)
    lRegData = GetRegDWORD(HKEY_LOCAL_MACHINE, RegAppRoot, "Font.TextColor", bRegErr)
    If (lRegData < 0 Or lRegData > &HFFFFFF) Or bRegErr Then lRegData = &HFFFFFF
    Optn_Font.TextColor = lRegData
    lRegData = GetRegDWORD(HKEY_LOCAL_MACHINE, RegAppRoot, "Font.BackColor", bRegErr)
    If (lRegData < 0 Or lRegData > &HFFFFFF) Or bRegErr Then lRegData = 0
    Optn_Font.BackColor = lRegData
    lRegData = GetRegDWORD(HKEY_LOCAL_MACHINE, RegAppRoot, "Font.BackTransparent", bRegErr)
    If (lRegData < 0 Or lRegData > 1) Or bRegErr Then lRegData = 0
    Optn_Font.BackTransparent = CBool(lRegData)
    lRegData = GetRegDWORD(HKEY_LOCAL_MACHINE, RegAppRoot, "ClockX", bRegErr)
    If (lRegData < 0 Or lRegData > &HFFFFFF) Or bRegErr Then lRegData = 30
    Optn_ClockX = lRegData
    lRegData = GetRegDWORD(HKEY_LOCAL_MACHINE, RegAppRoot, "ClockY", bRegErr)
    If (lRegData < 0 Or lRegData > &HFFFFFF) Or bRegErr Then lRegData = 30
    Optn_ClockY = lRegData
    lRegData = GetRegDWORD(HKEY_LOCAL_MACHINE, RegAppRoot, "DefaultDotSize", bRegErr)
    If (lRegData <> 0 And lRegData <> 1 And lRegData <> 2) Or bRegErr Then lRegData = 1
    Optn_DefDotSize = lRegData
    DrawRectIndex = Optn_DefDotSize
    InitClockDrawing
    PrevWindowProc = SetWindowLong(AppWnd, GWL_WNDPROC, AddressOf WindowProc)
    iDrawRedDotTimer = SetTimer(AppWnd, DrawRedDotTimerID, 1, 0)
End Sub


Download MainMod.bas

Back to file list


Back to project page