A Windows Forms component that provides enhanced MessageBox functionality

MessageBoxManager is a Windows Forms component I wrote that you can drag & drop into a Windows Forms project’s main form, and it gives you enhanced message box functionality without forcing you to change your existing calls to any of the MessageBox.Show() overloads . You can download it from :-

Note that, while the component is written using mixed-mode code, it can be used from C# or VB.NET with absolutely no hassles. In fact, the sample app in that article is a C# WinForms application.


Selecting a default folder with SHBrowseForFolder

Today, there was an article posted on the Code Project website that showed how to use SHBrowseForFolder, and there was a question from a reader in the forum, asking how a default folder can be specified. This is pretty easy to do, and all you need to do is to set the BIF_VALIDATE flag, specify a callback, and in the callback, handle BFFM_INITIALIZED which indicates that the dialog is ready, and then SendMessage a BFFM_SETSELECTION message to the HWND of the dialog. Here’s some commented code that shows how this is done.

int CALLBACK BrowseCallbackProc(HWND hwnd,
    UINT uMsg,LPARAM lParam,LPARAM lpData)
    // Look for BFFM_INITIALIZED
    if(uMsg == BFFM_INITIALIZED)
        SendMessage(hwnd, BFFM_SETSELECTION,
            TRUE,(LPARAM)_T("C:\\Program Files"));
    return 0;

void ShowSHBrowseForFolderDemoDlg()
    BROWSEINFO bi = {0};
    // Make sure BIF_VALIDATE is specified
    bi.lpszTitle = _T("Choose a folder");
    // Set the callback function
    bi.lpfn = BrowseCallbackProc;
    LPITEMIDLIST pIDL = SHBrowseForFolder(&bi);
        // Your code goes here...

Get the Office 2003 style menus/toolbars in your MFC apps using Windows Forms

This is my latest Code Project article, and it shows you how to use the Windows Forms 2.0 MenuStrip and ToolStrip controls in your MFC applications to give them an Office 2003 look and feel. These Forms controls are pretty well written, and if you change the XP theme/style, they change accordingly, just like Word or Excel would!

One year now!

Last Valentine’s day, Smitha and I got married in a nontraditional quiet function in Trivandrum, and the decision to do that has been the best one I’ve ever taken in my life. There was a period in my life when I thought that the greatest life I could achieve would be one where I earn a massive salary, get to work on the latest technologies, have a 10 Mbps line at home, own the coolest gadgets out there, have a BMW with an LCD based GPS, use a quad-proc machine at home with quadruple LCDs, and other similar stuff. Smitha changed all that! Now, all these things I mentioned are still wonderful to have, but only with Smitha by my side; without her, my life will be like a burned out candle that’s run out of wax! I don’t know how many of my blog readers have a woman (or a man), but I can tell you one thing – don’t let the bad relationships (and I’ve had one, so I know) convert you into single-hood for life. Having a companion throughout life is the most wonderful achievement any human being can have.

VS 2005 Document Explorer never finds anything

9 times out of 10, when I select a class name or a keyword and hit F1, the Document Explorer shows me an “Information Not Found” page. But at the same time, the index on the left has selected the topic I am looking for, which means all I need to do is to double click on that topic and the expected page loads. So it’s truly mysterious to me why the Document Explorer says it cannot find the required information! Am I the only one who gets these sort of errors? Pretty damned annoying when it happens all the time!