Home All Groups Group Topic Archive Search About

Error 453: Can't find DLL entry point (VB6)

Author
20 Oct 2005 9:39 PM
Bill Baker
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

Author
20 Oct 2005 9:56 PM
Saga
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
Author
20 Oct 2005 10:07 PM
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.
--
Bill Baker


Show quoteHide quote
"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
>
>
>
Author
20 Oct 2005 11:05 PM
MikeD
"Bill Baker" <BillBa***@discussions.microsoft.com> wrote in message
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.


The extension is "cs"?  That's weird.  It should be "cls".

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
Author
20 Oct 2005 10:22 PM
Ken Halter
"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>

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..
Author
20 Oct 2005 11:06 PM
Bill Baker
Got it. Thanks again!

--
Bill Baker


Show quoteHide quote
"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..
>
>
>