-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: Arv
Message 2 in Discussion
Hi, System.NullReferenceException error specifies that it needed a reference type
where It was passed a value type. There's are few points you need to consider while
calling Win API from .NET The first is that a Win32 pointer type translates to a
corresponding .NET reference type. The second rule is that a Win32 string pointer
generally translates to a .NET StringBuilder type (or, sometimes, to a String type).
The third rule is to look for a pointer/value mismatch if you get a
System.NullReferenceException from a P/Invoke call. I suggest , try finding the
similar .NET Class Library for the API and use that, if it is available. Paste your
code if the above method does not work. Here is example... Imports
System.Runtime.InteropServices
Imports System.Text
Module Module1
<DllImport("advapi32.dll")> _
Public Function GetUserName( _
ByVal lpBuffer As StringBuilder, _
ByRef nSize As Integer) As Boolean
End Function
Sub Main()
Dim b As StringBuilder = New StringBuilder(100)
Dim n As Integer = b.Capacity
Dim rc As Boolean = GetUserName(b, n)
Console.WriteLine(b)
End Sub
End Module Regards Arvind.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]