rtnMichael
Programmer
Hey, I'm having trouble figuring out why this isn't working...can someone shed some light on it for me?
<HTML>
<HEAD>
<script language="VBScript">
Option Explicit
Declare Function WNetGetUser& Lib "Mpr" Alias "WNetGetUserA" _
(lpName as Any, ByVal lpUserName$, lpnLength&)
Function CurrentUserName()
Dim ret as long
Dim cbusername as long
Dim username as String
username = Space(256)
ret = WNetGetUser(ByVal 0&, username, cbusername)
If ret = 0 Then
CurrentUserName = Left(username, InStr(username, Chr(0)) - 1)
else CurrentUserName = ""
end if
End Function
</script>
</HEAD>
<BODY>
<P>here's the username: <%CurrentUserName() %></P>
</BODY>
</HTML>
It gives me a type mismatch error, specifically:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'CurrentUserName'
I just want to get the username who logged in to the computer, and I've tried so many different ways....Any help would be great.
Thanks
Mike
<HTML>
<HEAD>
<script language="VBScript">
Option Explicit
Declare Function WNetGetUser& Lib "Mpr" Alias "WNetGetUserA" _
(lpName as Any, ByVal lpUserName$, lpnLength&)
Function CurrentUserName()
Dim ret as long
Dim cbusername as long
Dim username as String
username = Space(256)
ret = WNetGetUser(ByVal 0&, username, cbusername)
If ret = 0 Then
CurrentUserName = Left(username, InStr(username, Chr(0)) - 1)
else CurrentUserName = ""
end if
End Function
</script>
</HEAD>
<BODY>
<P>here's the username: <%CurrentUserName() %></P>
</BODY>
</HTML>
It gives me a type mismatch error, specifically:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'CurrentUserName'
I just want to get the username who logged in to the computer, and I've tried so many different ways....Any help would be great.
Thanks
Mike