eneate
asked on
argument not optional in a dll error. Does anyone know why me code is generating this error
Hi
I am using the following code to call functions from a dll
Private Declare Function CreateFile Lib "SynMF.dll" ( _
ByVal createfilename As String, _
ByVal magic As Long, _
ByVal appname As String, _
ByVal username As String, _
ByVal usercomments As String, _
ByVal sourcepath As String, _
ByVal sourcename As String, _
ByVal firstsourcenumber As Long, _
ByVal lastsourcenumber As Long, _
ByVal sourcetype As String, _
ByVal originx As Double, _
ByVal originy As Double, _
ByVal originz As Double, _
ByVal reversex As Boolean, _
ByVal reversey As Boolean, _
ByVal reversez As Boolean, _
ByVal factorx As Double, _
ByVal factory As Double, _
ByVal unitsxy As Long, _
ByVal factorz As Double, _
ByVal unitsz As Long, _
ByVal unitsdisplay As Long) As Boolean
When I include the following call
Dim createfilename As String
createfilename = FileNameBox.Text
Dim magic As Long
magic = 1
Dim appname As String
appname = App.Title & " v" & App.Major & "." & App.Minor & "." & App.Revision
Dim username As String
username = UserNameBox.Text
Dim usercomments As String
usercomments = UserCommentsBox.Text
Dim sourcepath As String
sourcepath = SourcePathBox.Text
Dim sourcename As String
sourcename = SourceNameBox.Text
Dim firstsourcenumber As Long
firstsourcenumber = FirstSourceBox.Text
Dim lastsourcenumber As Long
lastsourcenumber = LastSourceBox.Text
Dim sourcetype As String
sourcetype = FileTypeCombo.Text
Dim originx As Double
originx = XOriginBox.Text
Dim originy As Double
originy = YOriginBox.Text
Dim originz As Double
originz = ZOriginBox.Text
Dim reversex As Boolean
reversex = XReverseCheck.Value
Dim reversey As Boolean
reversey = YReverseCheck.Value
Dim reversez As Boolean
reversez = ZReverseCheck.Value
Dim factorx As Double
factorx = XYFactorBox.Text
Dim factory As Double
factory = XYFactorBox.Text
Dim unitsxy As Long
unitsxy = 3
Dim factorz As Double
factorz = ZFactorBox.Text
Dim unitsz As Long
unitsz = 3
Dim unitsdisplay As Long
unitsdisplay = 2
Dim result As Boolean
'result = CreateFile(createfilename, magic, appname, username, usercomments, sourcepath, sourcename, firstsourcenumber, lastsourcenumber, sourcetype, originx, originy, originz, reversex, reversey, factorx, factory, unitsxy, factorz, unitsz, unitsdisplay)
result = CreateFile(createfilename, magic, appname, username, usercomments, sourcepath, sourcename, firstsourcenumber, lastsourcenumber, sourcetype, originx, originy, originz, reversex, reversey, factorx, factory, unitsxy, factorz, unitsz, unitsdisplay)
If result = True Then
MsgBox "File created"
Else
MsgBox "Create FAILED"
End If
I have tried several configurations with no siccuess anyone any iadea why?
I am using the following code to call functions from a dll
Private Declare Function CreateFile Lib "SynMF.dll" ( _
ByVal createfilename As String, _
ByVal magic As Long, _
ByVal appname As String, _
ByVal username As String, _
ByVal usercomments As String, _
ByVal sourcepath As String, _
ByVal sourcename As String, _
ByVal firstsourcenumber As Long, _
ByVal lastsourcenumber As Long, _
ByVal sourcetype As String, _
ByVal originx As Double, _
ByVal originy As Double, _
ByVal originz As Double, _
ByVal reversex As Boolean, _
ByVal reversey As Boolean, _
ByVal reversez As Boolean, _
ByVal factorx As Double, _
ByVal factory As Double, _
ByVal unitsxy As Long, _
ByVal factorz As Double, _
ByVal unitsz As Long, _
ByVal unitsdisplay As Long) As Boolean
When I include the following call
Dim createfilename As String
createfilename = FileNameBox.Text
Dim magic As Long
magic = 1
Dim appname As String
appname = App.Title & " v" & App.Major & "." & App.Minor & "." & App.Revision
Dim username As String
username = UserNameBox.Text
Dim usercomments As String
usercomments = UserCommentsBox.Text
Dim sourcepath As String
sourcepath = SourcePathBox.Text
Dim sourcename As String
sourcename = SourceNameBox.Text
Dim firstsourcenumber As Long
firstsourcenumber = FirstSourceBox.Text
Dim lastsourcenumber As Long
lastsourcenumber = LastSourceBox.Text
Dim sourcetype As String
sourcetype = FileTypeCombo.Text
Dim originx As Double
originx = XOriginBox.Text
Dim originy As Double
originy = YOriginBox.Text
Dim originz As Double
originz = ZOriginBox.Text
Dim reversex As Boolean
reversex = XReverseCheck.Value
Dim reversey As Boolean
reversey = YReverseCheck.Value
Dim reversez As Boolean
reversez = ZReverseCheck.Value
Dim factorx As Double
factorx = XYFactorBox.Text
Dim factory As Double
factory = XYFactorBox.Text
Dim unitsxy As Long
unitsxy = 3
Dim factorz As Double
factorz = ZFactorBox.Text
Dim unitsz As Long
unitsz = 3
Dim unitsdisplay As Long
unitsdisplay = 2
Dim result As Boolean
'result = CreateFile(createfilename,
result = CreateFile(createfilename,
If result = True Then
MsgBox "File created"
Else
MsgBox "Create FAILED"
End If
I have tried several configurations with no siccuess anyone any iadea why?
your missing reversez in the call
ASKER
HI
Thanks for the feedback, but I now get the error bad dll calling convention, any idea why?
Thanks for the feedback, but I now get the error bad dll calling convention, any idea why?
Maybe try:
result = CreateFile(ByVal createfilename, ByVal magic, ByVal appname, ByVal username, ByVal usercomments, ByVal sourcepath, ByVal sourcename, ByVal firstsourcenumber, ByVal lastsourcenumber, ByVal sourcetype, ByVal originx, ByVal originy, ByVal originz, ByVal reversex, ByVal reversey, ByVal reversez, ByVal factorx, ByVal factory, ByVal unitsxy, ByVal factorz, ByVal unitsz, ByVal unitsdisplay)
ASKER
I still get the same error
When you get the error, can you click debug to see what line is being highlighted? Is it the call to CreateFile? I can't test any further because I don't have "SynMF.dll" on my system.
If you compile to an exe do you still get the same error?
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q153586
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q153586
ASKER
Hi
Sorry, been away, you are right when I compile and run the program I don't get the error, I guess it must be a vb 6 thing?
Sorry, been away, you are right when I compile and run the program I don't get the error, I guess it must be a vb 6 thing?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the feedback at least I know where the problem is.