473,491 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VB.NET: Implementing RasGetErrorString

bhc
i'm trying to wrap a RAS library, and i've found pretty solid examples
for most RAS API calls...except for RasGetErrorString. i've seen a C#
example, but can't seem to get the right declaration and use in VB.NET.
the current attempt is:
---
Private Declare Auto Function RasGetErrorString Lib "rasapi32.dll"
( _
ByVal ErrorValue As Integer, _
ByRef ErrorString As String, _
ByVal BufferSize As Integer _
) As Integer

'And then in a button click somewhere...
Dim errstr As String
Dim err As Integer = 639
Dim lbuff As Integer = 256

Debug.WriteLine(RasGetErrorString(err, errstr, lbuff))
Debug.WriteLine(errstr)
---

the call to RasGetErrorString fails with an unhandled
System.ExecutionEngineException - even if i trap it in a Try...Catch
block (?). any help would be appreciated...

May 19 '06 #1
2 1264
bhc
nevermind, i got it (sorry, just impatient i guess :).

Private Declare Auto Function RasGetErrorString Lib "rasapi32.dll"
( _
ByVal uErrorValue As Integer, _
ByVal lpszErrorString As IntPtr, _
ByVal cBufSize As Integer _
) As Integer

May 19 '06 #2
"bhc" <bc******@gmail.com> schrieb:
i'm trying to wrap a RAS library, and i've found pretty solid examples
for most RAS API calls...except for RasGetErrorString. i've seen a C#
example, but can't seem to get the right declaration and use in VB.NET.
the current attempt is:
---
Private Declare Auto Function RasGetErrorString Lib "rasapi32.dll"
( _
ByVal ErrorValue As Integer, _
ByRef ErrorString As String, _
ByVal BufferSize As Integer _
) As Integer

'And then in a button click somewhere...
Dim errstr As String
Dim err As Integer = 639
Dim lbuff As Integer = 256

Debug.WriteLine(RasGetErrorString(err, errstr, lbuff))
Debug.WriteLine(errstr)
---

the call to RasGetErrorString fails with an unhandled
System.ExecutionEngineException - even if i trap it in a Try...Catch
block (?). any help would be appreciated...


\\\
Private Declare Auto Function RasGetErrorString Lib "rasapi32.dll" ( _
ByVal uErrorValue As Int32, _
ByVal lpszErrorString As String, _
ByVal cBufSize As Int32 _
) As Int32
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
May 21 '06 #3

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

Similar topics

1
3479
by: Stuart Norris | last post by:
Hello Group, I am trying retreive a string with error information from the RASAPI using C#. Currently I am always getting blank string returned from the call to RasGetErrorString, even...
14
1733
by: Jim | last post by:
I am using VB.Net 2.0 and I am completely new to the concept of implementing interfaces. Can anyone explain "implementing interfaces" to me and perhaps give me an example of implementing an...
0
2544
by: shamirza | last post by:
ADO.Net Making the Connection: Accessing Your Database using ADO.NET Data Access Namespaces Within the .NET framework class library (FCL) version 1.1, there are five third-level namespaces that...
0
7115
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6978
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7190
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...
0
7360
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
5451
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,...
1
4881
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1392
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.