|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Error 453: Can't find DLL entry point (VB6)using a class module in an ActiveX DLL project: Public Enum logAccessType LogRead = 1 LogWrite = 2 LogAppend = 3 End Enum Public Function OpenLog(strLogFileName As String, strAppName As String, _ Optional strAccessType As logAccessType) As Long If strAccessType = 1 Then Open strLogFileName For Input As #1 ElseIf strAccessType = 2 Then Open strLogFileName For Output As #1 ElseIf strAccessType = 3 Then Open strLogFileName For Append As #1 End If ' Write initial message to log: Print #1, "************************************************" Print #1, "************ " & strAppName & " *********************" Print #1, "************************************************" End Function When I try to use the DLL in another VB6 project, I get the error "Can't find DLL entry point OpenLog in "...OpenLog.dll": Module1.bas: Public Declare Function OpenLog Lib "C:\OpenLog.dll" _ (ByVal strLogFileName As String, ByVal strAppName As String, _ ByVal intAccessType As Integer) As Long Form_Load: lngRet = OpenLog("c:\log.log", "test", 1) I've checked the path several times and it is correct. I've looked all over MSDN and Google for an answer to this issue and can't find any solutions. Thanks, -- Bill Baker Ouch!
You are trying to use that DLL as it were a Non COM object. All DLLs that VB6 creates are COM objects. Try doing something like this: 'Declare the COM object dim objOpenLog as <name of your class> 'Get it ready to work. set objOpenLog = new <name of your class> lngRet = objOpenLog.OpenLog("c:\log.log", "test", 1) The name of your class might be OpenLog, but can't really tell from the info that you posted. Oh, once you have your DLL done and compiled, you need to select its reference in the project that uses it. So before any dimming and setting :-) you need to use Project/References to open the dialog and then check the component that you'll be using. If done properly, your component should be included in the list of references. Good luck! Saga Show quoteHide quote "Bill Baker" <BillBa***@discussions.microsoft.com> wrote in message news:C2FB6E49-2D35-4728-8F2E-676420DF05B2@microsoft.com... >I am new to creating DLL's. I'm trying to create a very simple DLL in >VB6 > using a class module in an ActiveX DLL project: > > Public Enum logAccessType > LogRead = 1 > LogWrite = 2 > LogAppend = 3 > End Enum > > Public Function OpenLog(strLogFileName As String, strAppName As > String, _ > Optional strAccessType As logAccessType) As > Long > If strAccessType = 1 Then > Open strLogFileName For Input As #1 > ElseIf strAccessType = 2 Then > Open strLogFileName For Output As #1 > ElseIf strAccessType = 3 Then > Open strLogFileName For Append As #1 > End If > ' Write initial message to log: > Print #1, "************************************************" > Print #1, "************ " & strAppName & " *********************" > Print #1, "************************************************" > > End Function > > When I try to use the DLL in another VB6 project, I get the error > "Can't > find DLL entry point OpenLog in "...OpenLog.dll": > > Module1.bas: > Public Declare Function OpenLog Lib "C:\OpenLog.dll" _ > (ByVal strLogFileName As String, ByVal strAppName As String, _ > ByVal intAccessType As Integer) As Long > > Form_Load: > lngRet = OpenLog("c:\log.log", "test", 1) > > I've checked the path several times and it is correct. > > I've looked all over MSDN and Google for an answer to this issue and > can't > find any solutions. > > Thanks, > > -- > Bill Baker Thanks for the quick reply. Apparently my DLL was not created properly. When
I try to add it as a reference, it doesn't show up in the list. The class name is Open_Log.cs. Thanks again. -- Show quoteHide quoteBill Baker "Saga" wrote: > > Ouch! > > You are trying to use that DLL as it were a Non COM object. All DLLs > that VB6 creates are COM objects. > > Try doing something like this: > > 'Declare the COM object > dim objOpenLog as <name of your class> > > 'Get it ready to work. > set objOpenLog = new <name of your class> > > lngRet = objOpenLog.OpenLog("c:\log.log", "test", 1) > > The name of your class might be OpenLog, but can't really > tell from the info that you posted. > > Oh, once you have your DLL done and compiled, you need to > select its reference in the project that uses it. So before any dimming > and setting :-) you need to use Project/References to open the > dialog and then check the component that you'll be using. If done > properly, your component should be included in the list of references. > > Good luck! > Saga > > > "Bill Baker" <BillBa***@discussions.microsoft.com> wrote in message > news:C2FB6E49-2D35-4728-8F2E-676420DF05B2@microsoft.com... > >I am new to creating DLL's. I'm trying to create a very simple DLL in > >VB6 > > using a class module in an ActiveX DLL project: > > > > Public Enum logAccessType > > LogRead = 1 > > LogWrite = 2 > > LogAppend = 3 > > End Enum > > > > Public Function OpenLog(strLogFileName As String, strAppName As > > String, _ > > Optional strAccessType As logAccessType) As > > Long > > If strAccessType = 1 Then > > Open strLogFileName For Input As #1 > > ElseIf strAccessType = 2 Then > > Open strLogFileName For Output As #1 > > ElseIf strAccessType = 3 Then > > Open strLogFileName For Append As #1 > > End If > > ' Write initial message to log: > > Print #1, "************************************************" > > Print #1, "************ " & strAppName & " *********************" > > Print #1, "************************************************" > > > > End Function > > > > When I try to use the DLL in another VB6 project, I get the error > > "Can't > > find DLL entry point OpenLog in "...OpenLog.dll": > > > > Module1.bas: > > Public Declare Function OpenLog Lib "C:\OpenLog.dll" _ > > (ByVal strLogFileName As String, ByVal strAppName As String, _ > > ByVal intAccessType As Integer) As Long > > > > Form_Load: > > lngRet = OpenLog("c:\log.log", "test", 1) > > > > I've checked the path several times and it is correct. > > > > I've looked all over MSDN and Google for an answer to this issue and > > can't > > find any solutions. > > > > Thanks, > > > > -- > > Bill Baker > > > "Bill Baker" <BillBa***@discussions.microsoft.com> wrote in message The extension is "cs"? That's weird. It should be "cls".news:7282AD2E-963E-4759-93AC-9EA2D4ECB2D6@microsoft.com... > Thanks for the quick reply. Apparently my DLL was not created properly. > When > I try to add it as a reference, it doesn't show up in the list. > > The class name is Open_Log.cs. Anyway, the component is probably there in the References dialog, just not what you're expecting. How it is listed has nothing to do with the class name or any file names. The entry used in the References dialog comes from the "Project Description". This is set in Project Properties on the General tab. If you never set the project description, the entry used in References will "default" to the project's name. -- Mike Microsoft MVP Visual Basic "Saga" <antiSpam@somewhere.com> wrote in message Minor mod to the instructions.... Set the reference first so Intellisense news:uiCQgEc1FHA.1032@TK2MSFTNGP12.phx.gbl... > > Ouch! > > You are trying to use that DLL as it were a Non COM object. All DLLs > that VB6 creates are COM objects. > > Try doing something like this: works <g> Show quoteHide quote > 'Declare the COM object > dim objOpenLog as <name of your class> > > 'Get it ready to work. > set objOpenLog = new <name of your class> > > lngRet = objOpenLog.OpenLog("c:\log.log", "test", 1) > > The name of your class might be OpenLog, but can't really > tell from the info that you posted. > > Oh, once you have your DLL done and compiled, you need to > select its reference in the project that uses it. So before any dimming > and setting :-) you need to use Project/References to open the > dialog and then check the component that you'll be using. If done > properly, your component should be included in the list of references. > > Good luck! > Saga -- Ken Halter - MS-MVP-VB - http://www.vbsight.com DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Please keep all discussions in the groups.. Got it. Thanks again!
-- Show quoteHide quoteBill Baker "Ken Halter" wrote: > "Saga" <antiSpam@somewhere.com> wrote in message > news:uiCQgEc1FHA.1032@TK2MSFTNGP12.phx.gbl... > > > > Ouch! > > > > You are trying to use that DLL as it were a Non COM object. All DLLs > > that VB6 creates are COM objects. > > > > Try doing something like this: > > Minor mod to the instructions.... Set the reference first so Intellisense > works <g> > > > 'Declare the COM object > > dim objOpenLog as <name of your class> > > > > 'Get it ready to work. > > set objOpenLog = new <name of your class> > > > > lngRet = objOpenLog.OpenLog("c:\log.log", "test", 1) > > > > The name of your class might be OpenLog, but can't really > > tell from the info that you posted. > > > > Oh, once you have your DLL done and compiled, you need to > > select its reference in the project that uses it. So before any dimming > > and setting :-) you need to use Project/References to open the > > dialog and then check the component that you'll be using. If done > > properly, your component should be included in the list of references. > > > > Good luck! > > Saga > > > > -- > Ken Halter - MS-MVP-VB - http://www.vbsight.com > DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm > Please keep all discussions in the groups.. > > > |
|||||||||||||||||||||||