Click here to Skip to main content
15,914,452 members
Home / Discussions / C#
   

C#

 
GeneralRe: help Pin
joan_fl9-Sep-03 10:29
joan_fl9-Sep-03 10:29 
GeneralRe: help Pin
cheeseruler10-Sep-03 2:54
cheeseruler10-Sep-03 2:54 
Generalforce datagrid to display "ahead-0" of integer Pin
MeisterBiber9-Sep-03 3:18
MeisterBiber9-Sep-03 3:18 
GeneralRe: force datagrid to display "ahead-0" of integer Pin
Jim Stewart9-Sep-03 3:20
Jim Stewart9-Sep-03 3:20 
GeneralFrames in axWebBrowser control Pin
Andrlage9-Sep-03 1:52
Andrlage9-Sep-03 1:52 
GeneralRe: Frames in axWebBrowser control Pin
Jagadeesh VN9-Sep-03 3:38
Jagadeesh VN9-Sep-03 3:38 
GeneralRe: Frames in axWebBrowser control Pin
Andrlage9-Sep-03 11:54
Andrlage9-Sep-03 11:54 
GeneralRe: Frames in axWebBrowser control Pin
Arun Chembilath30-Apr-11 7:10
Arun Chembilath30-Apr-11 7:10 
GeneralDLL import and parameters Pin
gmar9-Sep-03 0:56
gmar9-Sep-03 0:56 
GeneralRe: DLL import and parameters Pin
Jagadeesh VN9-Sep-03 3:49
Jagadeesh VN9-Sep-03 3:49 
GeneralDragDrop registration failed Pin
Nick Seng8-Sep-03 18:24
Nick Seng8-Sep-03 18:24 
Generalusing activex/com listeners (callbacks) Pin
olivier.fillon@csiro.au8-Sep-03 15:47
olivier.fillon@csiro.au8-Sep-03 15:47 
GeneralRe: I have problem to drop image files to PictureBox control... Pin
Nick Parker8-Sep-03 15:38
protectorNick Parker8-Sep-03 15:38 
GeneralRe: I have problem to drop image files to PictureBox control... Pin
Donald_a9-Sep-03 3:36
Donald_a9-Sep-03 3:36 
GeneralStatus Bar with Custom Panels Pin
Clarke768-Sep-03 14:12
Clarke768-Sep-03 14:12 
GeneralGet window content as bitmap Pin
sumeat8-Sep-03 14:10
sumeat8-Sep-03 14:10 
GeneralRe: Get window content as bitmap Pin
azusakt8-Sep-03 15:36
azusakt8-Sep-03 15:36 
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.

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.