Attribute VB_Name = "Module1"
Dim propHwnd As Long
'rect
Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type
'cursor
Declare Function ShowCursor Lib "user32" (ByVal fShow As Integer) As Integer

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
    x As Long
    y As Long
    End Type
    Dim a As POINTAPI

Sub Main()
Dim area As RECT
' Check to see if we should blank the screen, or display
' the Setup dialog box.

If InStr(Command$, "/c") Then ' looks in command string for screen saver parameters
SetupForm.Show 1
ElseIf InStr(Command$, "/s") Then
FormSCR.Show
'ElseIf InStr(Command$, "/p") Then
'    propHwnd = Mid(Command$, 4)
'    GetWindowRect propHwnd, area
    
End If

' Wait until there are no form visible, then quit.
While DoEvents() > 0 ' Loop until no forms visible
Wend
End Sub

Sub HideMouse()
While ShowCursor(False) >= 0
Wend
End Sub

Sub ShowMouse()
While ShowCursor(True) < 0
Wend
End Sub

Public Function LlegeixFitxer() As String
If FileExist(BarraFinal(App.path) & "config.conf") Then
    Dim nCanal As Integer
    nCanal = FreeFile
    Dim Linia As String
    Open BarraFinal(App.path) & "config.conf" For Input As nCanal
    Line Input #nCanal, Linia
    LlegeixFitxer = Linia
    Close
End If
End Function

Public Function BarraFinal(ByVal nPath As String) As String
If Len(nPath) > 0 Then
    If Right(nPath, 1) = "\" Then
        BarraFinal = nPath
    Else
        BarraFinal = nPath & "\"
    End If
End If
End Function

Public Function FileExist(Fitxer As String) As Boolean
    FileExist = (Dir(Fitxer) <> "") And (Fitxer <> "")
End Function

Public Function GetMousePos(Optional ByRef X_Value, Optional ByRef Y_Value)
    GetCursorPos a
    X_Value = a.x
    Y_Value = a.y
End Function
