Classname.NetQueryDisplayInformation. However, I have a whole bunch of other DllImports declared Shared and used in the same way, and they don't have any problems, it's just NetQueryDisplayInformation.
-----Original Message----- From: J. Merrill [mailto:[EMAIL PROTECTED] Sent: 10 September 2003 03:49 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] DllImport and Declara The first is declared "shared"; the second is not. I wonder if that matters -- are you calling both using someinstance.NetQueryDisplayInformation, or are you calling the shared one with classname.NetQueryDisplayInformation ? Good luck. At 08:57 AM 9/10/2003 +0200, Sean Hederman wrote >Sorry about posting my previous on an old thread. > >Okay, here's my updated problem. Ideally I'd like to use DllImport. >However, have a look at the following two declares: ><DllImport("Netapi32")> _ Public Shared Function >NetQueryDisplayInformation(<MarshalAs(UnmanagedType.LPWStr)> ByVal >p_sServerName As String, ByVal p_iLevel As Integer, ByVal p_iIndex As >Integer, ByVal p_iEntriesRequested As Integer, ByVal >p_iPreferredMaximumLength As Integer, ByRef p_iReturnedEntryCount As >Integer, ByRef p_iBuffer As Integer) As Integer > >End Function > >Private Declare Function NetQueryDisplayInformation Lib "netapi32" >Alias "NetQueryDisplayInformation" (<MarshalAs(UnmanagedType.LPWStr)> >ByVal p_sServerName As String, ByVal p_iLevel As Integer, ByVal >p_iIndex As Integer, ByVal p_iEntriesRequested As Integer, ByVal >p_iPreferredMaximumLength As Integer, ByRef p_iReturnedEntryCount As >Integer, ByRef p_iBuffer As Integer) As Integer > >As far as I can see they should produce the exact same results. In >reality they only do if I pass in Nothing into ServerName. If I pass >\\DOMAINCONTROLLER for example, the DllImport returns a Server Not >Available error, whereas when I call the Declared function it returns >More Data, which is correct. Why are these two returning different >results? As far as I can see they are identical. [snip] J. Merrill / Analytical Software Corp =================================== This list is hosted by DevelopMentor(r) http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com ______________________________________________ "This information is intended only for the person or entity to which it is addressed and may contain private, confidential, proprietary and/or privileged material and may be subject to confidentiality agreements. Any review, retransmission, dissemination, or any other use of or taking of any action in reliance upon this information, by persons or entities other than the intended recipient, is prohibited. If you received this in error, please contact the sender and delete the material from all storage media. The company is neither liable for proper, complete transmission of the information contained in this communication, any delay in its receipt or that the mail is virus-free" =================================== This list is hosted by DevelopMentor� http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com
