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?
Joshua,
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.
HTH,
Bob
Thanks Bob. I have been using Depends and just looking for them alphabetically based on which .h or fdf the definintion is in.
Bob,
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?
Thanks,
Joshua
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:
Thomas
Unknown said: 1. Why would it be "faster" to interact with PW through a wrapper DLL rather then directly using the PW dlls?
1. Why would it be "faster" to interact with PW through a wrapper DLL rather then directly using the PW dlls?
For your first question:
Unknown said: 2. Custom Module Manager is as far as I see only installed with the SDK. How do you then get your program running at a non-SDK PC?
2. Custom Module Manager is as far as I see only installed with the SDK. How do you then get your program running at a non-SDK PC?
For your second question:
Please see the attached .pdf I have created on this topic. Simply in your development environment export out the appropriate bitness ProjectWise custom module entries and deploy to your client registries along with your custom module in the ProjectWise bin directory.
Hi Bob
Thank you for your very elaborate answers.
I do however need to get a full understanding of the implications of your statements on VBA usage.
Let me give an example
From a VBA application I want to make a list of documents stored in my PW. Should I:
And a side question: Is Visual Studio 2010 Express suitable as IDE? If not what is the minimum Visual Studio edition required.
I apologize for hijacking your thread.
By the way, you don't need Custom Modules if you are creating a stand alone application. Custom modules are for DLLs that are invoked from ProjectWise as it starts and usually contain menu items to dispay in ProjectWise. You can make a stand alone app in C++ and then see what make sense to put into a C++ COM dll and what makes sense to put into a .NET program. A standalone application samlple can be found at C:\Program Files (x86)\bentley\ProjectWise\SDK\samples\vaultlist if you have the SDK installed.
Most likely you will have Login, Logout, and most of your aaApi_function calls wrapped in the same DLL as they have data that they need to share. Login creates an HDSOURCE that is needed by Logout is an example.