473,513 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

w32_WNetGetUser not work Win98

this is my code :

I convert this code from VB6...
Problem : lResult =487

Private Declare Function w32_WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA"
(ByVal lpszLocalName As String, ByVal lpszUserName As String, ByVal
lpcchBuffer As Integer) As Integer
Public Sub GetCurrentLogon16(ByVal UserName As String, ByVal DomainName As
String)
Dim lpUserName As String
Dim lpnLength As Integer
Dim lResult As Integer
Dim lpDomain As String

lpUserName = New String(Chr(0), 256)
lResult = w32_WNetGetUser("", lpUserName, 256)

If lResult = 0 Then
lpUserName = Left(lpUserName, InStr(1, lpUserName, Chr(0)) - 1)
UserName = lpUserName
DomainName = GetDomainFromRegistry()
End If

End Sub

How?

Nov 21 '05 #1
3 1284
Hi,

WMI is not installed by default on Win98.

WMI Core
http://www.microsoft.com/downloads/d...displaylang=en

Ken
--------------------------
"Giovanni pepe" <cs*@msn.com> wrote in message
news:uu**************@TK2MSFTNGP14.phx.gbl...
this is my code :

I convert this code from VB6...
Problem : lResult =487

Private Declare Function w32_WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA"
(ByVal lpszLocalName As String, ByVal lpszUserName As String, ByVal
lpcchBuffer As Integer) As Integer
Public Sub GetCurrentLogon16(ByVal UserName As String, ByVal DomainName As
String)
Dim lpUserName As String
Dim lpnLength As Integer
Dim lResult As Integer
Dim lpDomain As String

lpUserName = New String(Chr(0), 256)
lResult = w32_WNetGetUser("", lpUserName, 256)

If lResult = 0 Then
lpUserName = Left(lpUserName, InStr(1, lpUserName, Chr(0)) - 1)
UserName = lpUserName
DomainName = GetDomainFromRegistry()
End If

End Sub

How?


Nov 21 '05 #2
Giovanni,

As I see this I get the idea that you want to get the current user, by
instance in VBNet code.

Dim UserName as String = Environment.UserName

Is that what you want to get?

Cor
Nov 21 '05 #3
"Giovanni pepe" <cs*@msn.com> schrieb:
I convert this code from VB6...
Problem : lResult =487

Private Declare Function w32_WNetGetUser Lib "mpr.dll" Alias
"WNetGetUserA"
(ByVal lpszLocalName As String, ByVal lpszUserName As String, ByVal
lpcchBuffer As Integer) As Integer
Public Sub GetCurrentLogon16(ByVal UserName As String, ByVal DomainName As
String)
Dim lpUserName As String
Dim lpnLength As Integer
Dim lResult As Integer
Dim lpDomain As String

lpUserName = New String(Chr(0), 256)
lResult = w32_WNetGetUser("", lpUserName, 256)


Try passing 'vbNullString' instead of "" in the first parameter.
Alternatively, you may want to use 'Environment.UserName' or
'SystemInformation.UserName' to get the current user name.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
343
by: Giovanni pepe | last post by:
this is my code : I convert this code from VB6... Problem : lResult =487 Private Declare Function w32_WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpszLocalName As String, ByVal...
2
1800
by: jon morgan | last post by:
Hi, I need to debug my app. under Windows 98. Although VS.net can't be installed it I have been able to install both Framework 1.1 and the SDK. Can I debug the app. in VS.net remotely from an...
6
2279
by: Andrzej | last post by:
Used to read newsgroup for answers, now have to ask for them as well. I have an application (C#, .NET 1.1) that connects to local db on MSDE 2000 SP3a (using ADO from MDAC 2.71) on one side and...
0
1581
by: Macadair | last post by:
I develop mid-range multi-user applications for a large site. Currently Win98 and Office97 are the standards used however we are slowly moving to WinXP. Due to the site upgrade cost, we are...
8
2584
by: mheden | last post by:
Hello all, I'm using an Access 97 front-end with a SQL Server 2000 back-end. One particular bit of code runs a stored procedure to obtain a rowcount from one of the back-end tables. This works...
4
1716
by: Wasi Rehman | last post by:
hi friends, I have one webservice which i want to run on win98 system because some reference in that webservice only run in win98, and my ASP.net application is on win2000 pro. I want to call that...
0
300
by: Krunoslav Ostrouska | last post by:
ArrayList included in object is not saved at clippboard copy in Win98 (Clipboard.SetDataObject() and IDataObject.GetData()) ! In WinXP, framework calls GetObjectData() and...
2
1345
by: billsahiker | last post by:
I have read in this group that the .net 2 framework redistributable package can be installed on win98 and it includes a vb.net command line compiler. IF this is so, what sort of debugging, if any,...
0
1565
by: Robert Dollinger | last post by:
Hi to everyone, I have a Service, that runs on a WinXP machine. The service read a file on a Win98 machine and write the content in a file on the WinXP machine. After tree times I get the error...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7521
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5682
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.