Blog moved to

February 17, 2011 Leave a comment
Categories: Windows API

Breakpoints in Windbg

January 15, 2011 Leave a comment

WinDbg rocks.🙂 Setting breakpoints is very easy in WinDbg. The command to set a breakpoint is ‘bp’. So if you want to break whenever a dll is loaded into a process then type in following command…

bp kernel32!LoadLibraryW

So to trigger this breakpoint attach ‘notepad.exe’ to the debugger and then type in this command. Now let the app run (press F5). Goto File->Open (this will trigger a definite LoadLibrary :)). Now have a look in WinDbg which will have following output…

Breakpoint 0 hit
00000000`76e50420 4533c0          xor     r8d,r8d

 To view call stack, type in ‘kpn’. I’ll blog more on breakpoints as and when I get time. Happy debugging.🙂

Run to cursor feature in Visual Studio

January 6, 2011 Leave a comment

This is one cool feature of Visual Studio which I very much like, the shortcut for this feature makes life even more easy.🙂 So what does this feature do?

Imagine we’re are stuck in a heavy duty for loop and you want to immediately break after the for loop but don’t want to traverse through the entire for loop iteration, move your cursor to the line below the for loop (of course it must be a c++ statement) and press Ctrl + F10. The result of this action is that the debugger will ‘execute’ (no it won’t skip) the entire for loop and break at the line that you chose.

I used to use this feature frequently so I guess this will help save sometime for you too.

Categories: C++, VC++ Tags:

2010 in review

January 6, 2011 Leave a comment

The stats helper monkeys at mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads Wow.

Crunchy numbers

Featured image

The Louvre Museum has 8.5 million visitors per year. This blog was viewed about 75,000 times in 2010. If it were an exhibit at The Louvre Museum, it would take 3 days for that many people to see it.

In 2010, there were 4 new posts, growing the total archive of this blog to 314 posts. There were 7 pictures uploaded, taking up a total of 206kb.

The busiest day of the year was January 7th with 571 views. The most popular post that day was How to use SendInput?.

Where did they come from?

The top referring sites in 2010 were,,,, and

Some visitors came searching, mostly for typedef array, cmfcpropertygridctrl, sendinput, visual studio 2008 “list control” clistctrl -listbox, and mfc feature pack.

Attractions in 2010

These are the posts and pages that got the most views in 2010.


How to use SendInput? August 2009
19 comments and 1 Like on,


MFC Feature Pack Tutorial – Part 3 – CMFCPropertyGridCtrl June 2008


MFC Feature Pack Tutorial – Part 1 – Getting started May 2008


How to convert ANSI string to UNICODE string and vice versa? July 2008


typedef a fixed length array July 2008

Categories: Windows API

Mandatory styles for a child dialog

If you are creating a dialog with style WS_CHILD then make sure you also have DS_CONTROL  and DS_CONTROLPARENT enabled for the dialog.

The reason being that the dialog at a time is a control (embedded inside another window) and a control parent (housing other controls). If these styles are not specified calls to GetWindowRect and then a subsequent ScreenToClient will return top co-ordinates in negative leading to some confusion.

Find an element in a list

Recently I worked on one C# project. Got to say it’s hell lot easier to code🙂. Found something cool while working on template based List class.

Guess that you got a list of employees stored in List, so how will you locate a particular employee by his name or based on certain employee attributes: like list all employees having salary greater than a particular employee. So our employee class will look like…

class Employee
  public bool IsSalaryGt(Object Emp) { return ((Emp as Employee).m_Sal > m_Sal); }
  private int m_Sal; // Init to some val

class Main
  private List<Employee> m_Emps;

  //So to locate all employees having salary greater than me we will  write
  void ListAllEmps_EarningMoreThanMe(Employee Me)
    List< Employee > Emps = m_Emps.FindAll(Me.IsSalaryGt);

How to show “Open with” dialog?

February 12, 2010 1 comment

It’s quite handy to show the standard windows open with dialog, which lists all installed applications along with a browse button. In Windows XP there is no straight forward way of doing this.

In Windows Vista onwards Microsoft has provided a shell API for this purpose. It’s called SHOpenWithDialog.

Some sample code (couldn’t test this though since I’m on XP at home)…

OPENASINFO Info = { 0 };
SHOpenWithDialog(NULL, &Info);

A screenshot of the dialog in XP…

Open with dialog

Open with dialog

%d bloggers like this: