Currently, there are methods that can be called directly. Directly through ShellExecute's taskbarpin verbs, such as:
1 ShellExecute (NULL, _t ("taskbarpin"),2 _t (" C:\\users\\titilima\\desktop\\test.lnk " ),3 null, NULL, SW_SHOWNORMAL);
It's been a while since Windows 7 was released, and today's topic is for this--Occupy Windows7 's taskbar, pin the application to the taskbar, or Unpin.
The specific method I also found some on the internet, but after a reverse of a program, find it is still elegant, so here is the method described. It should be explained that, due to various reasons, I can not give the source code. Here I only give a general step, I believe it is not a problem to understand. If you do not understand it, please check the MSDN documentation yourself based on your keywords.
- Consult the Shell32.dll string resource, find the ID of the PIN and Unpin command string, and write it down for later use;
- Create a Ishelldispatch interface;
- Get the Folder interface pointer corresponding to the path of the application via the Ishelldispatch interface;
- Get the FolderItem interface pointer for the application file name via the Folder interface;
- Get Folderitemverbs interface pointer via FolderItem interface;
- Enumerates the verb sets corresponding to the Folderitemverbs interface, obtains the name of each verb, obtains a string resource according to the string ID noted in step 1th, and pairs the verb name until the corresponding Folderitemverb interface pointer is found;
- Call Folderitemverb::D The Oit method, the application will be pin or unpin to the taskbar.
Action Windows7 shortcut to taskbar