Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
Generaltcpclient stream read Pin
mikemilano8-Sep-03 13:12
mikemilano8-Sep-03 13:12 
GeneralRe: tcpclient stream read Pin
leppie8-Sep-03 16:05
leppie8-Sep-03 16:05 
GeneralRe: tcpclient stream read Pin
leppie8-Sep-03 16:05
leppie8-Sep-03 16:05 
GeneralRe: tcpclient stream read Pin
Nick Parker8-Sep-03 16:25
protectorNick Parker8-Sep-03 16:25 
GeneralRe: tcpclient stream read Pin
TimK8-Sep-03 16:19
TimK8-Sep-03 16:19 
GeneralExtand and access the internat Microsoft Office object structure Pin
gicio8-Sep-03 9:47
gicio8-Sep-03 9:47 
GeneralJust a detailed question Pin
jphuphilly8-Sep-03 9:28
jphuphilly8-Sep-03 9:28 
GeneralRe: Just a detailed question Pin
leppie8-Sep-03 10:50
leppie8-Sep-03 10:50 
There is some helpful code in my MyDUMeter article, look at the ... o here you go:

[DllImport("Netapi32")]
private static extern int NetServerEnum(
    string servername, //must be null
    int level, //101
    out IntPtr buffer,
    int maxlen, //out
    out int entriesread, //out
    out int totalentries, //out
    int servertype, //in 3 = all
    string domain, //null primary
    int resumehandle); //must be 0


[DllImport("Netapi32")]
private static extern int NetApiBufferFree(IntPtr ptr);


[StructLayout(LayoutKind.Sequential)]
internal class ServerInfo 
{
    public int platformid;
    [MarshalAs(UnmanagedType.LPWStr)]
    public string name;
    public int majorver;
    public int minorver;
    public int type;
    [MarshalAs(UnmanagedType.LPWStr)]
    public string comment;
}


class MachineConvertor : TypeConverter 
{
    public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
    {
      int eread, etot;
      IntPtr buffer;
      int l = 200;     
      int size = Marshal.SizeOf(typeof(ServerInfo));
      int res = NetServerEnum(
          null, 
          101, 
          out buffer, 
          size * l, 
          out eread, 
          out etot, 
          3, 
          null, 
          0);

      IntPtr p = buffer;
      ArrayList arr = new ArrayList(etot);
      for (int i = 0; i < eread; i++)
      {
          ServerInfo si = Marshal.PtrToStructure(p, typeof(ServerInfo)) as ServerInfo;   
          if (si.majorver > 4 && si.name != "")
            arr.Add(si.name);
          p = (IntPtr)((int)p + size);
      }

      res = NetApiBufferFree(buffer);
      return new StandardValuesCollection(arr);
    }


    public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
    {
      return true;
    }
}


leppie::AllocCPArticle("Zee blog");
Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.

Questionwhat is the difference between [,] &amp; [][]? Pin
yyf8-Sep-03 8:32
yyf8-Sep-03 8:32 
AnswerRe: what is the difference between [,] &amp; [][]? Pin
David Stone8-Sep-03 9:06
sitebuilderDavid Stone8-Sep-03 9:06 
GeneralRe: what is the difference between [,] &amp; [][]? Pin
Anonymous12-Sep-03 6:09
Anonymous12-Sep-03 6:09 
QuestionHow to realloc? Pin
yyf8-Sep-03 8:30
yyf8-Sep-03 8:30 
AnswerRe: How to realloc? Pin
Daniel Turini8-Sep-03 9:18
Daniel Turini8-Sep-03 9:18 
AnswerRe: How to realloc? Pin
Nemanja Trifunovic8-Sep-03 9:30
Nemanja Trifunovic8-Sep-03 9:30 
Generaliterating controls on the form Pin
mcgahanfl8-Sep-03 5:05
mcgahanfl8-Sep-03 5:05 
GeneralRe: iterating controls on the form Pin
Donald_a8-Sep-03 5:12
Donald_a8-Sep-03 5:12 
GeneralRe: iterating controls on the form Pin
Corinna John8-Sep-03 7:25
Corinna John8-Sep-03 7:25 
GeneralRe: iterating controls on the form Pin
Donald_a8-Sep-03 21:59
Donald_a8-Sep-03 21:59 
GeneralRe: iterating controls on the form Pin
mcgahanfl9-Sep-03 3:55
mcgahanfl9-Sep-03 3:55 
GeneralRe: iterating controls on the form Pin
mcgahanfl9-Sep-03 4:00
mcgahanfl9-Sep-03 4:00 
GeneralListView and Icon Size Pin
malz8-Sep-03 4:33
malz8-Sep-03 4:33 
GeneralRe: ListView and Icon Size Pin
malz8-Sep-03 5:26
malz8-Sep-03 5:26 
GeneralPreviously focused control Pin
HJo8-Sep-03 2:49
HJo8-Sep-03 2:49 
GeneralRe: Previously focused control Pin
Corinna John8-Sep-03 7:31
Corinna John8-Sep-03 7:31 
GeneralRe: Previously focused control Pin
HJo8-Sep-03 20:00
HJo8-Sep-03 20:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.