Sorry about the above, this code's a bit easier to read. :o)
hFileIcon = (HICON) LoadImage(NULL, _T("c:\\test.ico"), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE);
hOldIcon = (HICON) SetClassLong(hWnd, GCL_HICON, (LONG) hFileIcon);
// (SetClassLong returns 0 & GetLastError returns 6...