dcsimg
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

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


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

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Buffer Return Problems

Question:
I am feeling very sick and was wondering if you could help me. I am trying to access the Lan Manager 2.1 API and am having difficulty get return data in my VB Structures (Types). I have never had to send a then retrieve data through dll with Types before an I am very confused and frustrated... As an example, Lanman has an api which returns information about the current workstation:
Declare Function NetWkstaGetInfo% Lib "NetAPI.dll" (ByVal Domain$, ByVal Level%, Buffer As Any, ByVal Bufsize%, Total%).
The VB code I am trying to use is as follows:
If NetWkstaGetInfo("", 1, "", 0, cbBuffer) = NERR_BufTooSmall Then
	retval = NetWkstaGetInfo("", 1, Buffer, cbBuffer, pcbTotalAvail)
Else
	MessageBox "Unable to retrieve User Network Information", 0
	Exit Sub
End If
The first line, NetWkstaGetInfo returns a buffer size (cbBuffer) of 214 bytes. But the data I get back appears to be garbage.

Answer:
Try calling the API with the following call:

retval = NetWkstaGetInfo(ByVal "", ByVal 1, ByVal Buffer, ByVal cbBuffer, ByVal pcbTotalAvail)
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