MS Access Forum / Forms Programming / January 2005
advapi32.dll-Can't register it to use in form
|
|
Thread rating:  |
Michael Miller - 10 Jan 2005 16:31 GMT I have an existing app running well on many machines. One particular machine is giving an error that it cannot find a library. I am using the advapi32.dll to get the user NT login name when they open my main form, and that is where the program halts.
I searched the registry and found it in many locations, and showing from at least two sources, win...\system and a .net folder. This machine does have vs.net installed, while the other machines do not.
I tried to re-register it using regsvr32 c:\winnt\system\advapi32.dll and it gave an error: ...was loaded but dllregisterserver entry point not found.
I saw the msgs here about registering an ocx, but the registry location does not apply to me? And, after my last clean attempt to register it, it only appears in the registry once, as noted below.
I did the obligatory reboots, both cold and warm, and even deleted all references to this dll and re-registered again. I get the same error, but it only appears in one area, windows, currentVersion, explorer, runmru, c, and then advapi32.dll\1, where the dll name did not appear that way, (with a 1), previously.
Anyone know how I can get this dll cooking on that machine?
 Signature MichaelM
Dan Artuso - 10 Jan 2005 16:49 GMT Hi, That DLL is a 'regular' one, not an ActiveX dll so you can't 'register' it. It simply exports functions. What is the OS that app is running on? Don't search the registry, search the system32 folder for it.
-- HTH Dan Artuso, Access MVP
> I have an existing app running well on many machines. > One particular machine is giving an error that it cannot find a library. [quoted text clipped - 22 lines] > -- > MichaelM Michael Miller - 10 Jan 2005 16:57 GMT Hi Dan,
It -is- in winnt\system32. The os (on all the machines) is Win 2000 pro. Note, that dll does appear in my other machine's registry; that's why I thought I had to register it.
When my form loads, I grab the nt user login name (on all the other machines), and on the other machine, I get the error that the library cannot be found.
MichaelM
> Hi, > That DLL is a 'regular' one, not an ActiveX dll so you can't 'register' it. [quoted text clipped - 31 lines] > > -- > > MichaelM Dan Artuso - 10 Jan 2005 17:15 GMT Can you post your Declare? Are you sure that this is the library that count be found?
-- HTH Dan Artuso, Access MVP
> Hi Dan, > [quoted text clipped - 44 lines] > > > -- > > > MichaelM Michael Miller - 10 Jan 2005 17:49 GMT Note: this all works on all my other users, except for this one machine
Bombing on this (X) line: Private Sub Form_Open(Cancel As Integer) Dim strUserName As String (X) Select Case LCase(fOSUserName())
...Case statements follow.
Declaration is:
Option Compare Database Option Explicit
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function is:
Public Function fOSUserName() As String 'returns the network login name
Dim lngLen As Long Dim lngX As Long Dim strUserName As String
strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen - 1) If (lngX > 0) Then fOSUserName = Left$(strUserName, lngLen) Else fOSUserName = vbNullString End If
End Function
MichaelM
> Can you post your Declare? Are you sure that this is the library that > count be found? [quoted text clipped - 51 lines] > > > > -- > > > > MichaelM Dan Artuso - 10 Jan 2005 18:51 GMT Hi, Okay, I'm not sure what to suggest. You can try going to Tools->References and seeing if one is marked missing or simply unchecking one then re-checking it.
Also, have you stepped through the code?
-- HTH Dan Artuso, Access MVP
> Note: this all works on all my other users, except for this one machine > [quoted text clipped - 91 lines] > > > > > -- > > > > > MichaelM Michael Miller - 10 Jan 2005 20:19 GMT Not only is nothing missing from References, but all that are checked off on a working machine are also checked off on the non working machine. And, all the versions appear to be the same.
The code stops in the form open (highlighted yellow-cursor position), and the Select Case line has LCase highlighted in blue.
MichaelM
> Hi, > Okay, I'm not sure what to suggest. You can try going to [quoted text clipped - 102 lines] > > > > > > -- > > > > > > MichaelM Dan Artuso - 11 Jan 2005 00:44 GMT Hi, We need to see where in the fOSUserName function it is failing. So, set a breakpoint and step through the code. I suspect it's not because of the dll but some reference. Do all the machines have the same version of Access?
-- HTH Dan Artuso, Access MVP
> Not only is nothing missing from References, but all that are checked off on > a working machine are also checked off on the non working machine. And, all [quoted text clipped - 111 lines] > > > > > > > -- > > > > > > > MichaelM Michael Miller - 11 Jan 2005 14:37 GMT Hi Dan,
SOLV-ED. I went in again this morning to start stepping thru the code and ouella, I got a different error upon first loading the form. It said that msadox.dll wasn't working. So, I jumped on that, unchecked it in References, saved and exited Access, went back in and re-checked and saved it and exited again.
Upon loading the main form again, she worked. Thanks for hanging in with me.
Only problem I have now is that I started getting 'unsafe blocking' is not on and they want to install the jet 4 upgrade. But, When I go to windows update, I can't drill down to it. Will keep trying.
MichaelM
> Hi, > We need to see where in the fOSUserName function [quoted text clipped - 121 lines] > > > > > > > > -- > > > > > > > > MichaelM Michael Miller - 10 Jan 2005 20:23 GMT References correction:
the -not working- machine has MS Access 11.0 Object Lib and, the -working- machine has MS Access 9.0 Object Lib
MichaelM
> Hi, > Okay, I'm not sure what to suggest. You can try going to [quoted text clipped - 102 lines] > > > > > > -- > > > > > > MichaelM
|
|
|