August 26, 2008

Set the Computer’s Name Through .NET

You can set your computer’s name using the SetComputerName function, which is available in kernel32.dll: //Codeusing System.Runtime.InteropServices; [DllImport(“kernel32.dll”)] static extern bool SetComputerName(string lpComputerName); bool status = SetComputerName(“MyDen”);

Set Multiple Fonts Using Single CFont Object

Did you know you can set multiple fonts for several controls using a simple CFont object in MFC? Using the Detach() method, which disassociates the associated window object from a wrapper object, you can write the code as follows: The code portion can be as follows: { CFont f; f.CreateFont(..);

Loading Classes Directly from .jar Archives

Whenever a class is referenced in a Java program, the class is loaded using the class loader from the JVM’s bootstrap or from the application-server. This often becomes a problem when you want to load two different classes with same name and same package declaration. For example, suppose your JVM’s