Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996

Network Logon/Logoff Functions

Question:
I am trying to create a VB program to log a user onto a workgroup (from a windows for workgroups client) and then map local drives and devices to a network resource. I am able to map the drives and devices using the API WNetAddConnection but I do not know an API that will perform the equivalent of net logon and net logoff. Is there such a function?

Answer:
I did a bit of virtual reading through the Win32 API manuals and did not see anything even remotely close to what you are looking for. Unfortunately, it looks like all of the functions assume that you are logged in before you start doing anything.

However, the WNetAddConnection2 API call is able to take a username and password as parameters to it. Most of the other API calls also have this variation available, so you may want to try it instead of trying to log the user on. The declaration of the API is shown here. For more documentation, refer to the Solutions Development Kit or an API reference book.

Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" (lpNetResource As NETRESOURCE, ByVal lpPassword As String, ByVal lpUserName As String, ByVal dwFlags As Long) As Long
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date