I'm using the Foreground Window object to retrieve window titles, however, sometimes a program has no window title at all and so returns an empty string. I know I can get a windows handle but I don't think this is unique to a specific program.

Is there a way to retrieve the actual program name or something instead? Or maybe some other way?