shell.GetCurrentProcessExplicitAppUserModelID

str = GetCurrentProcessExplicitAppUserModelID()

Retrieves the current taskbar identifier

Comments

Will only retrieve an identifier if set by the application, not a system-assigned default.

Requires Windows 7 or later