Just a detailed question
-
Okay im trying to learn server side programming and i just want to know is it possible to create a program that list all the computers on a network then puts them all in a listbox then you can select a computer and that computer we'll be shown a message box or something like that Basically im tryin to build a program like freeze tag for computers. I know c# pretty well but i don't know how to list the computers on the network then how would i show them a message box or something like that. Uh i know it kinda detailed but any help would be greatly appreciated. Thanks alot:-D:-D Da Intern
-
Okay im trying to learn server side programming and i just want to know is it possible to create a program that list all the computers on a network then puts them all in a listbox then you can select a computer and that computer we'll be shown a message box or something like that Basically im tryin to build a program like freeze tag for computers. I know c# pretty well but i don't know how to list the computers on the network then how would i show them a message box or something like that. Uh i know it kinda detailed but any help would be greatly appreciated. Thanks alot:-D:-D Da Intern
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.