gillrowley
Programmer
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
- and -
Here's the code for the dll -
Any ideas? Thanks.
"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
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