|
-
Jan 19th, 2000, 05:35 PM
#1
Thread Starter
Member
Hi, I'm trying to get some old code working (it's been converted from VB3 binary format).
i've had a few problems but managed to solve them but the latest one is puzzling me (i'm a bit of a beginner).
when i try to run the program i get the error message
Runtime error '6':
overflow
and the piece of code
chk = Shell(ret, 8)
is highlighted when i click the debug button
the function is shown below
does anyone have any ideas
thanks in advance
MICK
Private Function StartAcad() As Integer
Dim ret$
Dim nSize%, chk%, chk2%
ret = String$(145, Chr$(0))
nSize = Len(ret)
chk2 = True
chk = GetPrivateProfileString("AUTOCAD", "EXEPATH", "", ret, nSize, INI_path)
If chk = 0 Then
MsgBox "Unable to start AutoCAD, check PLOTLOG.INI for validity."
chk2 = False
Else
chk = Shell(ret, 8)
End If
StartAcad = chk2
End Function
-
Jan 19th, 2000, 05:43 PM
#2
Hyperactive Member
Allmost all Win32 API's are changed from integer to long... change the declarations of the integers to long and it should work (at least no overflow error...)
-
Jan 20th, 2000, 12:57 PM
#3
Guru
You need a double or variant variable to receive the return value of the SHELL function:
from MSDN:
Shell Function
Runs an executable program and returns a Variant (Double) representing the program's task ID if successful, otherwise it returns zero.
So change that % to a #
Better yet, explicitly declare the data types instead of using those old-fashioned operators, so the next programmer won't want to strangle you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|