//
My CodeProject Articles

Here is a list of the CodeProject articles I’ve written, or otherwise had a hand in making.

Getting to know IExtenderProvider
This article attempts to teach the reader the basics of creating their own component that implements the IExtenderProvider interface. This interface is used to add “fake” properties to another control, the component can then use the values on these fake properties to do something interesting. The ToolTip control adds several properties to each control to control the behavior of the tooltip to be displayed. It makes up part of what I think is the coolest thing in the Visual Studio 2002/2003 designer.

Understanding Embedded Resources in Visual Studio .NET
This article attempts to explain the naming scheme that the embedded resources in Visual Studio .NET receive. Because of the quite awful support for the assembly resource files in Visual Studio 2002/2003 I find it much easier to embeed images, and small files this way.

TSWizard – A wizard framework for .NET
This article provides a wizard framework for use in your own applications. Each step in the wizard is made up of a UserControl and the next and previous steps are controlled by properties on the step. Feel free to use it as is or modify it to your heart’s content.

Creating and Using Attributes in your .NET Application
If this wasn’t my first article, it was one of the first. Just describes the basics of attributes and how to use them in your .NET application.

Simulating polymorphic operator overloads with C#
I didn’t do much writing on this article; but Nishant and I talked about this one quite a bit before it was written. The point of this article is that when you are coming from a C++ background you could be used to the correct operator overload being called in a polymorphic environment. C# and .NET don’t work this way because operator overloads are implemented as static methods, outside of the realm of polymorphic calls. Using the == operator as an example, we discuss ways of working around the problem so that your class hierarchy’s operator overloads behave as you are used to from C++.

Using reflection to extend .NET programs
Another one of my first articles; this one explains the basics of reflection so that you can use it to load another assembly and call its methods and properties. My intention with the article was to show how to create a very basic plugin architecture. Since then better implementations have come along, one written by the (then) C# Program Manager.

Image Rotation in .NET
I wrote this article when a friend of mine needed to be able to rotate an image, but didn’t want it to be cut off when rotated. This article is the result of that night of work. There are some comments to the article that reveal some better ways of doing it; but the rest of the article could be interesting to read.

Clipboard handling with .NET – Part II
Part 2? Where is part 1? This article was a dual effort between myself and Nishant to explain the basics and not-so-basics of working with the Clipboard in .NET applications. Nishant covered the basics in part 1 of the article and I wrote the more advanced basics dealing with storing multiple formats on the clipboard and registering your own clipboard formats. In with that I cover storing a .NET object on the clipboard directly.

The key to multi-threaded Windows Forms UI interaction
I wrote this article shortly after I finished the demo application for the TSWizard framework. Thinking back over the articles I had read I didn’t recall seeing any that really pounded in the need to rely on the BeginInvoke/Invoke methods when writing multithreaded code. Then again I also didn’t see much code talking about multithreading to begin with. But the consequences of not knowing this could be far worse than covering something no one needed.

.NET XML Serialization – a settings class
The XML Serializer in the .NET framework quite frankly, sucks. It won’t handle so many cases that it can be hard to use it at all. This article describes some workarounds that you can use to create an XML document easily.

Using Generics in C++/CLI
Nish wrote this article with my input about ways to get around the lack of partial template specialization in the .NET implementation of generics.

Christian and James’ Code Project Screensaver
Way back when, CodeProject was running a screensaver competition. After talking with Christian Graus for sometime I started to help him try to speed up with screensaver so we could get it doing more things. In the end we won the C# division of the competition :D.

An Elementary HTML Parser
I’m not really happy with this article…at least the title of it anyway. Despite the title this essentially uses the XML parser to look for HTML elements and store the text and any formatting into a data structure.

TypeLoader for .NET
Another article I’m not too proud of…this should have been integrated back into the “Using reflection to extend .NET programs” article. Basically I just provide a class to use that will go out and search for types for you rather than having to write all the code yourself. Big whoop.

Discussion

7 thoughts on “My CodeProject Articles

  1. how i can know the mac of a pc if i know the

    ip

    thank you

    Posted by abead | July 1, 2005, 9:46 am
  2. Random question… but here’s a random reply:

    The only way I know of is to parse the output of the nbtstat command, and far as I know it is only available in XP and higher and only if you are the administrator.

    /// Retrieve the remote MAC of a machine, given IP.
    ///
    /// This function may or may not work on Windows 2000 and lower. Also, it is using
    /// the nbtstat cache, so the machine has to have been on recently for it to work.
    /// And you have to be administrator.
    ///
    public static string RemoteAddress(string host) {
    // try to resolve it
    string ip = “”;
    try {
    ip = Dns.GetHostByName(host).AddressList[0].ToString();
    } catch(SocketException) {
    ip = host;
    }

    // init the process
    ProcessStartInfo psi= new ProcessStartInfo();
    psi.FileName = “nbtstat”;
    psi.RedirectStandardInput = false;
    psi.RedirectStandardOutput = true;
    psi.Arguments = “-A ” + ip;
    psi.CreateNoWindow = true;
    psi.UseShellExecute = false;

    // run it
    Process proc = new Process();
    proc = Process.Start(psi);
    proc.WaitForExit();

    // parse the output
    string res = proc.StandardOutput.ReadToEnd();

    if (res.Length [\S]*)”).Groups[“MAC”].ToString();
    }

    Hope this helps.

    Posted by hross | July 15, 2005, 9:02 am
  3. James,

    I recently read your IExtenderProvider article on CodeProject and found it to be very imformative. I am wrtting an article for CodeProject that will incorporate the knowledge gleaned from your article extending the MenuItem component and plan to put a mention of you and you article in it!

    Thanks,
    Mike

    Posted by Mike Hankey | March 17, 2007, 7:53 pm
  4. I’d like to place my app.config in a different directory from the
    CS proj rootdir, and be able to use ConfigurationManager
    namespace methods to read it. (I’m building a custom class lib
    for this purpose.)

    How do I point my application to the app.config in it’s non-standard
    location/directory?

    Fred Z – Atlanta GA

    Posted by Fred Zimmerman | April 10, 2007, 10:35 am
  5. Some links to CodeProject are broken. For instance ScreenSaver Competition. Nice blog BTW.

    Posted by Zeeshan | August 29, 2008, 4:46 am
  6. Thanks Zeeshan, I’ve updated the links to the articles.

    Posted by James | August 30, 2008, 11:18 pm
  7. @abead:

    you can’t

    Posted by aaa | March 13, 2009, 11:36 am

Leave a comment

Archive