Group:  Microsoft Access ยป microsoft.public.access.modulescoding
Thread: Can't find dll entry point

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Can't find dll entry point
"Julia Boswell" <jcrackne[ at ]hotmail.com> 06.02.2006 16:23:06
Hi all,

I'm new to API calls and have used some code I got on a training course,
which is giving me an error message. I haven't got a clue what the problem
is (have searched google but to no avail). Can anyone help me please? The
code is:

Public strUserName As String

'API Declaration - uses WNGetUser as alias
Private Declare Function WNGetUser Lib "mpr.dll" _
Alias "WNetGetUser" (ByVal lpName As String, _
ByVal lpUserName As String, lpnLength As Long) As Long

Function fnBSIGetUserName() As Boolean
Dim lngRet As Long
strUserName = Space(256)
lngRet = WNGetUser("", strUserName, 256)
If lngRet = 0 Then
strUserName = LCase(Left(strUserName, InStr(strUserName, Chr(0)) -
1))
fnBSIGetUserName = True
Else
MsgBox "There was a problem retrieving the user name", vbCritical +
vbOKOnly, "Error!"
fnBSIGetUserName = False
End If
End Function

I have checked and mpr.dll exists on my C drive.

Any ideas gratefully received.

Julia


Re: Can't find dll entry point
"Douglas J Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 06.02.2006 16:42:38
I believe the declaration needs to be

Private Declare Function WNGetUser Lib "mpr.dll" _
Alias "WNetGetUserA" (ByVal lpName As String, _
ByVal lpUserName As String, lpnLength As Long) As Long

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Julia Boswell" <jcrackne[ at ]hotmail.com> wrote in message
news:O9HDemzKGHA.1032[ at ]TK2MSFTNGP11.phx.gbl...
[Quoted Text]
> Hi all,
>
> I'm new to API calls and have used some code I got on a training course,
> which is giving me an error message. I haven't got a clue what the problem
> is (have searched google but to no avail). Can anyone help me please? The
> code is:
>
> Public strUserName As String
>
> 'API Declaration - uses WNGetUser as alias
> Private Declare Function WNGetUser Lib "mpr.dll" _
> Alias "WNetGetUser" (ByVal lpName As String, _
> ByVal lpUserName As String, lpnLength As Long) As Long
>
> Function fnBSIGetUserName() As Boolean
> Dim lngRet As Long
> strUserName = Space(256)
> lngRet = WNGetUser("", strUserName, 256)
> If lngRet = 0 Then
> strUserName = LCase(Left(strUserName, InStr(strUserName, Chr(0)) -
> 1))
> fnBSIGetUserName = True
> Else
> MsgBox "There was a problem retrieving the user name", vbCritical
+
> vbOKOnly, "Error!"
> fnBSIGetUserName = False
> End If
> End Function
>
> I have checked and mpr.dll exists on my C drive.
>
> Any ideas gratefully received.
>
> Julia
>
>


Re: Can't find dll entry point
"Julia Boswell" <jcrackne[ at ]hotmail.com> 06.02.2006 16:49:22
Thanks, what an idiot I am - a typo! That fixed it :-)
"Douglas J Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> wrote in message
news:uyNoYxzKGHA.3408[ at ]TK2MSFTNGP12.phx.gbl...
[Quoted Text]
>I believe the declaration needs to be
>
> Private Declare Function WNGetUser Lib "mpr.dll" _
> Alias "WNetGetUserA" (ByVal lpName As String, _
> ByVal lpUserName As String, lpnLength As Long) As Long
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Julia Boswell" <jcrackne[ at ]hotmail.com> wrote in message
> news:O9HDemzKGHA.1032[ at ]TK2MSFTNGP11.phx.gbl...
>> Hi all,
>>
>> I'm new to API calls and have used some code I got on a training course,
>> which is giving me an error message. I haven't got a clue what the
>> problem
>> is (have searched google but to no avail). Can anyone help me please? The
>> code is:
>>
>> Public strUserName As String
>>
>> 'API Declaration - uses WNGetUser as alias
>> Private Declare Function WNGetUser Lib "mpr.dll" _
>> Alias "WNetGetUser" (ByVal lpName As String, _
>> ByVal lpUserName As String, lpnLength As Long) As Long
>>
>> Function fnBSIGetUserName() As Boolean
>> Dim lngRet As Long
>> strUserName = Space(256)
>> lngRet = WNGetUser("", strUserName, 256)
>> If lngRet = 0 Then
>> strUserName = LCase(Left(strUserName, InStr(strUserName,
>> Chr(0)) -
>> 1))
>> fnBSIGetUserName = True
>> Else
>> MsgBox "There was a problem retrieving the user name", vbCritical
> +
>> vbOKOnly, "Error!"
>> fnBSIGetUserName = False
>> End If
>> End Function
>>
>> I have checked and mpr.dll exists on my C drive.
>>
>> Any ideas gratefully received.
>>
>> Julia
>>
>>
>
>


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net