Hi,
I've created my screensaver (as nearly everyone knows by now....., I've posted so many messages here reecntly.....)
I'm facing a problem when I set my .scr file as the screensaver. When I move the mouse I get a run-time error
"File access path error". But this error doesn't occur everytime. Can anyone tell me if there's an error on my code? I'm pasting the module's code below.
FrmScr --> form on which I've placed an image control.Code:'This is the code in the module. Option Explicit Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long Public Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long Public Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Dim My_Rect As RECT Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Public Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Public Const WS_CHILD = &H40000000 Public Const SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE Public Const GWL_EXSTYLE = (-20) Public Const GWL_HWNDPARENT = (-8) Dim PrevHwnd As Long Dim RetVal As Long Sub Main() Dim MyStr As String Dim MyComm As String Dim Test As Long Dim LHwnd As Long 'If App.PrevInstance = True Then End MyStr = Trim(Command$) MyComm = Mid(MyStr, 1, 2) If (MyComm = "/p") Then ElseIf (MyComm = "/s") Then FrmScr.Show ElseIf (MyComm = "/c") Then MsgBox "No setings" ElseIf (MyComm = "/a") Then MsgBox "Password Settings disabled" End If End Sub
Im using a timer to get jpeg files from a .RES file and loading them into the image control.
I've used the mousedown, keydown and mousemove events of the form and the image control to unload my form and end my application.
Thanx.




Reply With Quote