The app icons on the taskbar are programmed to do one thing by default; bring up a preview window of all open windows, and switch to the one you click on. You can tweak the registry and change its behavior quite a bit. For example, you can change the size of the previews, or you can replace the previews with a list view. In both cases, you have to select the window that you want to switch to from the list. If you want to automatically switch to the last active window of an app when you click its icon in the taskbar, you can do so by making a small edit to the registry.
Switch to last active window
Open the registry editor. You can use Windows Search to look for it, or you can type ‘regedit’ in the run box and run it from there. You will need admin rights to make changes to the registry.
Once you have the registry editor open, go to the following location;
Right-click the Advanced key and select New>DWORD (32-bit) Value from the context menu. Name this value LastActiveClick. Double-click it and in the box that opens, enter 1 in the value data field. Click OK, and close the registry editor.
You now have to restart explorer.exe to apply the change. The easiest way to do this is from the Task Manager. Open it and on the Processes tab, look for Windows Explorer. Select it, and click the Restart button at the bottom.
When your taskbar and desktop return, the change will have been applied.
How it works
This will work for windows of the same app. Let’s say you have three Notepad files open on your desktop as shown below. You minimize each one, one by one. So, going with the example and the screenshot below, you will minimize the Notepad file with ‘3’ in it first, then the one with ‘2’, and then the one with ‘1’. This means the last active window will be the Notepad file with ‘1’ in it.
After all three windows have been minimized, when you click the Notepad icon on the taskbar, the Notepad file with ‘1’ in it will automatically be restored. When you click the Notepad icon again, the file with ‘2’ in is will be restored, and when you click it one more time, the file with ‘3’ in it will be restored.
When you click it a fourth time, and there are no other windows left to restore, clicking the app icon will start cycling through the open windows in the same order they were restored in.