I'm learning how to use the ProjectWise API through VBA, and I'm trying to build a basic Hello World program. So far, I have:
Public Declare Function aaApi_Initialize Lib "DMSCLI.dll" (ByVal ulModule As Long) As LongPublic Declare Function aaApi_GetCurrentUserId Lib "DMSCLI.dll" () As LongPublic Declare Function aaApi_Login Lib "DMSCLI.dll" (ByVal lDsType As Long, lpctstrDSource As String, ByVal lpctstrUser As String, ByVal lpctstrPassword As String, ByVal lpctstrSchema As String) As BooleanSub LogIn() Dim result1 As Boolean Dim result2 As Boolean Dim result3 As Long 'Initialize the API result1 = aaApi_Initialize(AAMODULE_ALL) 'Login to PW using single sign-on result2 = aaApi_Login(AAAPIDB_UNKNOWN, "XYZABC.my.site.com:PWOPPID_ABC", vbNullString, vbNullString, vbNullString) 'Get ID for current user result3 = aaApi_GetCurrentUserId() End Sub
The aaApi_Login() call is returning false, and I don't know why. I want to use aaApi_GetLastErrorID() to inspect the problem, but I don't know which DLL to use for declaring it.
Short of running a dumpbin on every DLL in the ProjectWise\Bin folder and searching through each dump, is there an easier way to find out which DLL should be used to declare a given function? Is this information available somewhere in the SDK that I've overlooked?
Here are a couple tips and the primary answer to your question.
dumpbin /EXPORTS *.dll | findstr "following aaApi_GetLastErrorId"
Provides an abbreviated list (below) showing which .dll you would need to actively reference.
C:\Program Files (x86)\Bentley\ProjectWise\bin>dumpbin /EXPORTS *.dll | findstr "following aaApi_GetLastErrorId" Section contains the following exports for acledit.dll Section contains the following exports for Bentley.Crypto.1.0.dll ...
Section contains the following exports for DMSGEN.dll 198 C5 0000AF80 aaApi_GetLastErrorId = _aaApi_GetLastErrorId@0 Section contains the following exports for dmslogapi.dll Section contains the following exports for dmsmapiclient.dll...
Please note the following:
Feel free to reply to this thread to let us know if this or something else helped resolve the issue.
Thanks Bob. I have been using Depends and just looking for them alphabetically based on which .h or fdf the definintion is in.
Thanks for your advice on this. The findstr.exe approach will work fine for my purposes.
If I understand correctly, you are recommending that I create a class library (DLL) in C++ that makes the ProjectWise API calls, then use the ProjectWise Custom Module Manager to register the DLL, so that I can call these wrapper functions in VBA and keep an abstraction layer between my VBA code and the underlying API calls. Is this an accurate understanding of what you're suggesting?
Joshua - yes. Overtime you will see and realize the benefits of taking this approach. Whether a VBA or .NET project needing to perform ProjectWise or MicroStation API calls this will provide faster and more easily debuggable code and allowing you to create a simpler, reusable, and stable interface for others to use.
I few questions to your statements: