[RESOLVED] Error in Running a screen saver "Run-time error '6' Overflow"
Im running the program screen saver but i receiving this error its says Run-time error '6' Overflow i hope anyone could fix this thanks ...
VB Code:
Private Sub Form_Load()
Dim res
'I made this array to translate name of day to Indonesia
'language. You can change this array elemen to your
'country language. Start from Sunday...
aHari = Array("Sunday", "Monday", "Tuesday", "Wednesday", _
"Thursday", "Friday", "Saturday")
sHari = aHari(Abs(Weekday(Date) - 1))
frmMain.Caption = "LOGIN PROGRAM Versi 1.0"
frmMain.Timer1.Enabled = False
Timer1.Enabled = True
DoEvents
Label1.Caption = "" & sHari & ", " _
& Format(Date, "mmmm dd yyyy")
Label2.Caption = Format(Time, "hh:mm:ss")
DoEvents
App.HelpFile = ""
res = SetWindowPos(frmScreenSaver.hWnd, _
HWND_TOPMOST, 0, 0, 0, 0, _
flags)
End Sub
But its only highlightened at
VB Code:
App.HelpFile = ""
res = SetWindowPos(frmScreenSaver.hWnd, _
HWND_TOPMOST, 0, 0, 0, 0, _
flags)
Re: Error in Running a screen saver "Run-time error '6' Overflow"
This error is occur when the data capacity in database is incorrect
Check ur data base field and form field
Also tell were error is occuring
Re: Error in Running a screen saver "Run-time error '6' Overflow"
Where are you defining frmScreenSaver (I assume it's a form in this program) and flags?
And you should dim res as long - right now it's a variant - and use longs as the four arguments to the API. Use 0& if you don't want to declare a variable.
Re: Error in Running a screen saver "Run-time error '6' Overflow"
Hey lord_cedrich,
What does your declare statement for SetWindowPos look like. You might have an integer instead of long.
VB Code:
'If it's in a module it should be:
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As [COLOR=Blue]Long[/COLOR], 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
I run into this problem anytime I open an older program that was written for 16-bit instead of the current 32-bit operating systems.
Re: Error in Running a screen saver "Run-time error '6' Overflow"
here is the code
VB Code:
Private Sub Form_Click()
Private Sub Form_Click()
If frmSetting.ScreenSaverPassword.Value = 1 Then
frmPassword.Show 1
Else
Unload Me
Set frmScreenSaver = Nothing
End If
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If frmSetting.ScreenSaverPassword.Value = 1 Then
frmPassword.Show 1
Else
Unload Me
Set frmScreenSaver = Nothing
End If
End Sub
Public Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
lblTekan.Caption = "Press any key or click your mouse on this screen to exit..."
End Sub
Private Sub tmrQuartz_Timer()
Dim Hours As Single, Minutes As Single, Seconds As Single
Dim TrueHours As Single
sHari = aHari(Abs(Weekday(Date) - 1))
Label1.Caption = "" & sHari & ", " _
& Format(Date, "mmmm dd yyyy")
Label2.Caption = Format(Time, "hh:mm:ss")
Hours = Hour(Time)
Minutes = Minute(Time)
Seconds = Second(Time)
'I got this code (Analog Clock) from
'M. Thaha Husain.
'Thanks to Husain!
TrueHours = Hours + Minutes / 60
LineHour.X2 = 750 * Cos(PI / 180 * (30 * TrueHours - 90)) + LineHour.X1
LineHour.Y2 = 750 * Sin(PI / 180 * (30 * TrueHours - 90)) + LineHour.Y1
LineMinute.X2 = 1050 * Cos(PI / 180 * (6 * Minutes - 90)) + LineHour.X1
LineMinute.Y2 = 1050 * Sin(PI / 180 * (6 * Minutes - 90)) + LineHour.Y1
LineSecond.X2 = 1100 * Cos(PI / 180 * (6 * Seconds - 90)) + LineHour.X1
LineSecond.Y2 = 1100 * Sin(PI / 180 * (6 * Seconds - 90)) + LineHour.Y1
End Sub
Re: Error in Running a screen saver "Run-time error '6' Overflow"
Do you have any modules ? Just check your declare for SetWindowPos()
VB Code:
'If it's in a module it should be:
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
Re: Error in Running a screen saver "Run-time error '6' Overflow"
i think this is the code
VB Code:
'--- Start TopMostOfAll...
Declare Function SetWindowPos Lib "user32" (ByVal h%, ByVal hb%, _
ByVal X%, ByVal Y%, ByVal cx%, ByVal cy%, ByVal F%) As Integer
Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const flags = SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
'--- End of TopMostOfAll...
Re: Error in Running a screen saver "Run-time error '6' Overflow"
Quote:
Originally Posted by lord_cedrich
i think this is the code
VB Code:
'--- Start TopMostOfAll...
Declare Function SetWindowPos Lib "user32" (ByVal h[COLOR=Red]%[/COLOR], ByVal hb[COLOR=Red]%[/COLOR], _
ByVal X[COLOR=Red]%[/COLOR], ByVal Y[COLOR=Red]%[/COLOR], ByVal cx[COLOR=Red]%[/COLOR], ByVal cy[COLOR=Red]%[/COLOR], ByVal F[COLOR=Red]%[/COLOR]) As [COLOR=Red]Integer[/COLOR]
Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const flags = SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
'--- End of TopMostOfAll...
The parts in red are wrong - the variables should have the & type designator and the function should be declared as Long.
Re: Error in Running a screen saver "Run-time error '6' Overflow"
ohhhh! thanks a lot .... my problem has been solved ......