Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime 453 error

Status
Not open for further replies.

gillrowley

Programmer
Apr 2, 2004
59
US
I created a dll that will be called from another program. Basically it is just a simple function that changes a password. I compiled the dll, copied it to the system32 directory, and successfully registered it with regsvr32.exe. When I try to call the dll I get the following error:

"Can't find DLL entry point ChangeCrystalPassword in Crystal.dll".

Here's code that calls the dll
Code:
Public Function GoGetIt(userid, password)
    GoGetIt = CrystalPassword(userid, password)
    MsgBox GoGetIt
End Function
- and -
Code:
Declare Function CrystalPassword Lib "Crystal.dll" Alias "ChangeCrystalPassword" (ByVal userid As String, ByVal password As String) As Boolean

Here's the code for the dll -
Code:
Option Explicit
Dim someDay As Date


Public Sub Main()
    someDay = Now
End Sub


Public Function ChangeCrystalPassword(userID As String, preLinkPassword As String)

'********************************************************************************
'   Crystal Enterprise Login Constants
'********************************************************************************
    Const cms As String = "NGLCRYSTAL"
    Const crystalID As String = "crysalIDy"
    Const crystalPassword As String = "crystalPass"
    Const authenticationType As String = "secEnterprise"
    
'********************************************************************************
'   Crystal Enterprise Components
'********************************************************************************
    Dim mySessionMgr As SessionMgr
    Dim myEnterpriseSession As EnterpriseSession
    Dim myInfoStore As InfoStore
    Dim agent As CrystalInfoStoreLib.InfoObjects
    Dim user As CrystalUserPluginLib.user
    
    Dim sql As String
    
'********************************************************************************
'   Instantiate Crystal Enterprise Components
'********************************************************************************
    Set mySessionMgr = New SessionMgr
    Set myEnterpriseSession = mySessionMgr.Logon(crystalID, crystalPassword, cms, authenticationType)
    Set myInfoStore = myEnterpriseSession.Service("", "InfoStore")
    
    If Not myEnterpriseSession Then
        Exit Function
    End If
    
'********************************************************************************
'   Password Update Process
'********************************************************************************
    sql = "SELECT SI_ID, SI_NAME, SI_USERFULLNAME " _
        & "FROM CI_SYSTEMOBJECTS " _
        & "WHERE SI_NAME = '" & userID & "' and SI_PROG_ID = 'CrystalEnterprise.User'"
        
    Set agent = myInfoStore.Query(sql)
    
    If agent.Count > 0 Then
        Set user = agent(1).PluginInterface("")
        user.NewPassword = preLinkPassword
        myInfoStore.Commit agent
    End If
        
 '********************************************************************************
'   Kill Crystal Enterprise Components
'********************************************************************************
    Set myEnterpriseSession = Nothing
    Set myInfoStore = Nothing
    Set mySessionMgr = Nothing
    
End Function
Any ideas? Thanks.
 
You have created a COM based DLL (VB is only capable of making COM Dlls) and are trying to call using the non-COM calls.

What you need to do is add a reference to your dll (project->references) then dim an object and instance it...

Code:
dim obj as <your object name>

set obj = new <your object name>

obj.CrystalPassword(userid, password)

set obj = nothing

Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
Thanks, that helped. I have other errorsnow, but I will attempt to deal with those before posting again. At least it's calling the dll now.
 
>VB is only capable of making COM Dlls

Not quite true (but probably not a subject we want to get into here ...)
 
Being new to writing a dll, I was missing the Sub Nain, and then I had it in the class and not the module. Now that I have those it works just fine.

The little things they don't always tell you in the developer handbooks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top