How to delete the recent Programs icon on the SP home interface

Source: Internet
Author: User

From: http://blog.csdn.net/zxjl0214/archive/2008/10/10/3051928.aspx

One expert said that the recent Programs icon on the home interface can be removed as long as the registry key value is modified:

[HKEY_CURRENT_USER/system/State/Shell]

"Start MRU"

I tried it for a moment, and I can post it for a moment.

 

E.g. The Code is as follows:

Removerecentprograms (_ T ("// windows // Start Menu // messaging. lnk "));

  1. Bool removerecentprograms (tchar * szlnkpath)
  2. {
  3. Bool Bret = false;
  4. Hkey = NULL;
  5. Byte * pdata = NULL;
  6. Byte * pdatanew = NULL;
  7. Byte * pindex = NULL;
  8. DWORD dwtype;
  9. DWORD cbdata;
  10. Int ilnkcount = 0;
  11. Int icurlen = 0;
  12. If (error_success! = Regopenkeyex (HKEY_CURRENT_USER, _ T ("system // state // shell"), 0, 0, & hkey ))
  13. {
  14. Goto exit;
  15. }
  16. If (error_success! = Regqueryvalueex (hkey, _ T ("start mru"), null, & dwtype, null, & cbdata ))
  17. {
  18. Goto exit;
  19. }
  20. Pdata = new byte [cbdata];
  21. If (! Pdata)
  22. {
  23. Goto exit;
  24. }
  25. If (error_success! = Regqueryvalueex (hkey, _ T ("start mru"), null, & dwtype, pdata, & cbdata ))
  26. {
  27. Goto exit;
  28. }
  29. Ilnkcount = pdata [0];
  30. Pindex = pdata + 4;
  31. Icurlen = 4;
  32. For (INT I = 0; I <ilnkcount; I ++)
  33. {
  34. Int ilnklen = pindex [0];
  35. If (! _ Tcscmp (szlnkpath, (tchar *) (pindex + 12 )))
  36. {
  37. Pdatanew = new byte [cbdata-ilnklen];
  38. If (! Pdatanew)
  39. {
  40. Goto exit;
  41. }
  42. Memcpy (pdatanew, pdata, icurlen );
  43. If (icurlen + ilnklen <cbdata)
  44. {
  45. Memcpy (pdatanew + icurlen, pdata + icurlen + ilnklen, cbdata-icurlen-ilnklen );
  46. }
  47. Pdatanew [0] --;
  48. If (error_success! = Regsetvalueex (hkey, _ T ("start mru"), 0, dwtype, pdatanew, cbdata-ilnklen ))
  49. {
  50. Goto exit;
  51. }
  52. Bret = true;
  53. Break;
  54. }
  55. Pindex + = ilnklen;
  56. Icurlen + = ilnklen;
  57. }
  58. Exit:
  59. If (pdata)
  60. {
  61. Delete [] pdata;
  62. }
  63. (Pdatanew)
  64. {
  65. Delete [] pdatanew;
  66. }
  67. If (hkey)
  68. {
  69. Regclosekey (hkey );
  70. }
  71. Return Bret;
  72. }

ReferenceBearbrotherjiResearch results:

1. Start four bytes, such as 0a 00 00,
The first byte is the number of shortcuts recently used, that is, the number displayed on the main interface. This is usually 0 XA (10) after a period of use );
2. After the four bytes, all the shortcuts are used. We will illustrate only one of them, for example:
0x50, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x5c, 0x00, 0x57, 0x00,
0x69, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x6f, 0x00,
0x77, 0x00, 0x73, 0x00, 0x5c, 0x00, 0x53, 0x00,
0x74, 0x00, 0x61, 0x00, 0x72, 0x00, 0x74, 0x00,
0x20, 0x00, 0x4d, 0x00, 0x65, 0x00, 0x6e, 0x00,
0x75, 0x00, 0x5c, 0x00, 0x53, 0x00, 0x69, 0x00,
0x6d, 0x00, 0x54, 0x00, 0x6b, 0x00, 0x55, 0x00,
0x49, 0x00, 0x2e, 0x00, 0x6c, 0x00, 0x6e, 0x00,
0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Each shortcut starts with four bytes, followed by the "0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff" of the eight bytes ", the first character of these four bytes will change, but I do not know the meaning of this character, but it does not affect the processing;
Then there is a string corresponding to the path and file name of the shortcut file,
At last, there must be a 4bytes data with a 4 bytes address alignment, indicating the end of this shortcut;

If you want to implement the function as you mentioned, delete a recently used shortcut icon from the main interface,
First, reduce the value of the first byte by 1,
Next, find the complete string corresponding to the shortcut you want to delete in the entire string, and delete the segment, while retaining the rest (remember not to delete the subsequent string as well, to be connected, write back );

 

My supplement:

Each shortcut starts with four bytes, which indicates the length of the lnk, including the four bytes starting with, "0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff "the length of the eight bytes and the lnk string (including the filled 0x00 bytes ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.