Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / May 2006

Tip: Looking for answers? Try searching our database.

VB.NET: Implementing RasGetErrorString

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bhc - 19 May 2006 15:31 GMT
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...
bhc - 19 May 2006 16:29 GMT
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
Herfried K. Wagner [MVP] - 20 May 2006 19:55 GMT
"bhc" <bchorney@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#
[quoted text clipped - 20 lines]
> 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
///

Signature

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.