Since you will be using the hourglass cursor during a lengthy operation, you need to load it. The most convenient place to load it is during the initialization tasks handled by the InitInstance function. Add the following statement to InitInstance:
hHourGlass = LoadCursor(NULL, IDC_WAIT);
This makes the hourglass cursor available whenever it is needed.