I can't find the function PrintUIEntry at MSDN, but I'd expect it to return something, so check for return after calling your function pointer.

T ret = PrintUIEntry(
GetDesktopWindow(),...