473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Whats the proper way to use an external DLL?

TheSmileyCoder
2,322 Expert Mod 2GB
I have been asked to try and get my access database to "speak" with an external third party application, ProjectWise.

This involves using a dll, that comes with projectwise, dmactrl.dll.

However its not one I can simply register as a reference and use, but I can use with the following syntax:

Expand|Select|Wrap|Line Numbers
  1. Public Declare Function aaApi_MessageBox _
  2.                         Lib "dmactrl.dll" ( _
  3.                         ByVal strText As String, _
  4.                         ByVal lPRojectID As Long) _
  5.                         As Long
My problem is the following: When I try to use(run) the aaApi_MessageBox function i get an error:
Run Time Error 53
File Not Found: dmactrl.dll
If I try to the dll as a reference by Tools->References and browse for it, i get the error (When adding ref):
Can't add a reference to the specified file
The odd part is that if I run my code now, it will work without the previously mentioned error 53.


I have no experience working with external dlls, and I really have no idea why one is working and why one isn't, and even worse, I have no idea how to be able to fix it into a version I can actually present to the client, I.E. a solution that does not involve having to try and fail to register the dll each time.

Can anyone shed some light on the behavior explained, and hopefully on how to proceed from here?
Oct 16 '11 #1
12 5803
ADezii
8,834 Expert 8TB
  1. Is your Declaration in a Standard Code Module?
  2. How, exactly, are you 'Calling' the Function?
  3. Where, exactly, is the .dll (dmactrl.dll) physically located?
Oct 16 '11 #2
NeoPa
32,556 Expert Mod 16PB
I would expect your code to work if either :
  1. dmactrl.dll were in a default folder for libraries.
  2. You give the full path for dmactrl.dll.

Let us know how you get on with that Smiley.
Oct 17 '11 #3
NeoPa
32,556 Expert Mod 16PB
It may be a good idea to check with ProjectWise either for some documentation or advice (depending on what's available) on how the software should be installed. Sometimes such libraries will work by just being found available, but nevertheless the correct procedure is to run an installation package. Such a package aught to ensure the file is placed in a workable folder.
Oct 17 '11 #4
ADezii
8,834 Expert 8TB
Here are a couple of additional thoughts:
  1. Not all .DLLs are Self Registering. Have you tried to manually Register dmactrl.dll?
    Expand|Select|Wrap|Line Numbers
    1. Regsvr32 "<PATH to dmactrl.dll>"
  2. Have you tried doing multiple searches for dmactrl.dll in the Registry? There should be multiple References to it, including its PATH, such as:
    Expand|Select|Wrap|Line Numbers
    1. %SystemRoot%\System32\dmactrl.dll
Oct 17 '11 #5
TheSmileyCoder
2,322 Expert Mod 2GB
@ Post #2:
1) Yes its in a standard module
2) An example of calling the function:
Expand|Select|Wrap|Line Numbers
  1. Public Declare Function aaApi_MessageBox _
  2.                         Lib "dmactrl.dll" ( _
  3.                         ByVal strText As String, _
  4.                         ByVal lPRojectID As Long) _
  5.                         As Long
  6.  
  7. Public Sub testMsgBox()
  8.     Dim lngReply As Long
  9.     lngReply = aaApi_MessageBox(StrConv("Testing", vbUnicode), 1)
  10.     MsgBox "User pressed: " & lngReply
  11. End Sub
Now this will fail as mentioned earlier, but succeed if I have first tried and failed to register it as a reference by Tools->Reference->Browse
3) Its standard location is the PW SDK folder:
C:\Program Files\Bentley\ProjectWise V8i\bin\dmactrl.dll
I have also tried to place it in the access folder where the mdb is, as well in C:\Windows\System32


@ Post #3:
1) I don't know what the default library is/should be, but I have tried the locations mentioned above
2) I have tried to use the declare where I included the full path, but it still says "File Not found"


@ Post #4:
I have installed the PW SDK but frankly the documention on PW makes the access help files look like a verbose Written for Dummies guide, and there is very little help in the form of forums like Bytes to help a newbie getting started. That said I have started a thread on their webforum as well, but with no results so far.


@ Post #5:

First off, I don't know all that much about the system registry.
1) I have tried to register it using:
Expand|Select|Wrap|Line Numbers
  1. regsvr32 "C:\Program Files\Bentley\ProjectWise V8i\bin\dmactrl.dll"
and get this message back, which sadly doesn't mean a whole lot to me:
C:\Program Files\Bentley\ProjectWise V8i\bin\dmactrl.dll was loaded but the DllRegisterServer entry point was not found.
This file can not be registered.
2) I will try that.




Hope I managed to answer all your points, and thank you very much for your keen input.
Oct 18 '11 #6
ADezii
8,834 Expert 8TB
@TheSmileyCoder:
  1. Have you recently Rebooted your PC, if not, do so since there may be a corrupt Version of dmactrl.dll in Memory.
  2. Have you tried to Register this .dll while logged on with an Administrative Account, with full Privileges? You probably will need to be an Administrator to properly Register the .dll.
  3. I cannot locate dmactrl.dll on the Web to download, can you Upload us a Copy? This would make things much easier on our end.
Oct 18 '11 #7
NeoPa
32,556 Expert Mod 16PB
Nice response Smiley :-)

Always nice to work with a pro.
Oct 18 '11 #8
The function will fail unless the ProjectWise SDK is initialized prior to use.

Try this:
Expand|Select|Wrap|Line Numbers
  1. Public Const AAMODULE_TOOLS As Int32 = &H100L
  2. Public Declare Function aaApi_Initialize Lib "dmscli.dll" (ByVal ulModule As Int32) As Boolean
and then:
Expand|Select|Wrap|Line Numbers
  1. bRet = aaApi_Initialize(AAMODULE_TOOLS)
If you execute the aaApi_MessageBox function now, it should work correctly.
Aug 7 '13 #9
TheSmileyCoder
2,322 Expert Mod 2GB
Hi, thank you for your post. I will give it a try. :)
Aug 7 '13 #10
TheSmileyCoder
2,322 Expert Mod 2GB
Hi. So I tried to modify your suggestion to work with VBA, making it look like so:
Expand|Select|Wrap|Line Numbers
  1. Public Const AAMODULE_TOOLS As Long = 256
  2. Public Declare Function aaApi_Initialize Lib "C:\Program Files (x86)\Bentley\ProjectWise\bin\dmscli.dll" (ByVal ulModule As Long) As Boolean
  3.  
  4. Public Sub Test()
  5.    Dim bRet As Long
  6.    bRet = aaApi_Initialize(AAMODULE_TOOLS)
  7.    Debug.Print "bret:" & bRet
  8. End Sub
  9.  
It returns with an Error 53 - File not found. I recall someone having a similar error on another unrelated project, and the cause being not having Visual Studio installed while the DLL using dynamic linking (I believe so, its been a while, and I am not used to working with dlls)
Aug 7 '13 #11
ianadd
2
Did you resolve this? I have a very similar issue.
Ian
Nov 25 '13 #12
TheSmileyCoder
2,322 Expert Mod 2GB
No I never got Projectwise to work in a satisfying manner. In the end I was able to get limited success from going directly to the SQL server on which projectwise runs, but I never got satisfying results from projectwise.
Nov 26 '13 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: T. Kaufmann | last post by:
Hi there, I have some lines of code in a Tkinter programm - I want to list every single file of a zip-archive in a Text widget: fp = os.popen("%s %s" % ('unzip -vl ', 'anyarchiv.zip', 'r')...
6
by: thesushant | last post by:
hi, whats the use of third argument to main( ), i.e. environmental parameters.... if i am not wrong ? 1st 1 is argc 2nd is argv and what bout the 3rd 1??????????? sushant
2
by: Showjumper | last post by:
Whats the diff between the 2 and when do you use one and not the other?
3
by: | last post by:
Hello all, can someone possibly clear up what the 'proper' way to abstract DB access is? (Using C#, though it shouldnt matter) For example my asp page calls a web service that has an...
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
7
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell...
2
by: ras26 | last post by:
I have a WebSite "App1" which has an external assembly "Lib1". Inside this external assembly we have developed some classes that derive from "System.Web.UI.Page". One of these pages is called...
2
by: Jeff Kish | last post by:
Hi. I'm stuck using a very old c++ compiler, and I'm trying to figure out how to add a declaration so that an algorithm can be used. This is really a compiler specific problem, however I was...
38
by: Neo Geshel | last post by:
I am seeking a method to load one JS file directly into another, *without* having to dynamically write <scripttags. Is there any method whereby I can call only one external JS file using a ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.