资源简介
Windows 7程序开发系列之二(JumpList篇2 - Destination)的源代码。
教程地址:http://blog.csdn.net /ntwilford
![](http://www.nz998.com/pic/48485.jpg)
代码片段和文件信息
#include “FileRegistration.h“
#include
#include
#include
HRESULT RegSetString(HKEY hkey PCWSTR pszSubKey PCWSTR pszValue PCWSTR pszData)
{
size_t lenData = lstrlen(pszData);
return HRESULT_FROM_WIN32(SHSetValue(
hkey pszSubKey pszValue REG_SZ pszData static_cast((lenData + 1) * sizeof(*pszData))));
}
HRESULT RegisterProgID(LPCWSTR lpszProgID BOOL fRegister)
{
HRESULT hr;
if (fRegister)
{
HKEY hkeyProgID;
hr = HRESULT_FROM_WIN32(RegCreateKeyEx(HKEY_CLASSES_ROOT lpszProgID 0 NULL REG_OPTION_NON_VOLATILE
KEY_SET_VALUE | KEY_CREATE_SUB_KEY NULL &hkeyProgID NULL));
if (SUCCEEDED(hr))
{
hr = RegSetString(hkeyProgID NULL L“FriendlyTypeName“ L“Custom Jump List Document“);
if (SUCCEEDED(hr))
{
WCHAR szAppPath[MAX_PATH];
hr = (GetModuleFileName(NULL szAppPath ARRAYSIZE(szAppPath)) > 0) ? S_OK : HRESULT_FROM_WIN32(GetLastError());
if (SUCCEEDED(hr))
{
WCHAR szIcon[MAX_PATH + 3];
hr = StringCchPrintf(szIcon ARRAYSIZE(szIcon) L“%s0“ szAppPath);
if (SUCCEEDED(hr))
{
hr = RegSetString(hkeyProgID L“DefaultIcon“ NULL szIcon);
if (SUCCEEDED(hr))
{
hr = RegSetString(hkeyProgID L“CurVer“ NULL lpszProgID);
if (SUCCEEDED(hr))
{
HKEY hkeyShell;
hr = HRESULT_FROM_WIN32(RegCreateKeyEx(hkeyProgID L“shell“ 0 NULL REG_OPTION_NON_VOLATILE
KEY_SET_VALUE | KEY_CREATE_SUB_KEY NULL &hkeyShell NULL));
if (SUCCEEDED(hr))
{
WCHAR szCmdLine[MAX_PATH * 2];
hr = StringCchPrintf(szCmdLine ARRAYSIZE(szCmdLine) L“%s %%1“ szAppPath);
if (SUCCEEDED(hr))
{
hr = RegSetString(hkeyShell L“Open\\Command“ NULL szCmdLine);
if (SUCCEEDED(hr))
{
hr = RegSetString(hkeyShell NULL NULL L“Open“);
}
}
RegCloseKey(hkeyShell);
}
}
}
}
}
}
RegCloseKey(hkeyProgID);
}
}
else
{
long lRes = RegDeleteTree(HKEY_CLAS
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2010-06-03 23:44 JumpList2\
目录 0 2010-06-03 23:44 JumpList2\JumpList2\
文件 238787 2010-06-03 21:19 JumpList2\JumpList2\APP.ico
文件 5634 2010-06-03 22:58 JumpList2\JumpList2\FileRegistration.cpp
文件 355 2009-08-13 05:40 JumpList2\JumpList2\FileRegistration.h
文件 1686 2010-06-03 21:19 JumpList2\JumpList2\JumpList2.rc
文件 4289 2010-06-03 22:47 JumpList2\JumpList2\JumpList2.vcproj
文件 1417 2010-06-03 23:42 JumpList2\JumpList2\JumpList2.vcproj.wilford-NB.wilford.user
文件 4286 2010-06-03 23:43 JumpList2\JumpList2\main.cpp
文件 497 2010-06-03 21:19 JumpList2\JumpList2\resource.h
文件 0 2010-06-03 23:38 JumpList2\JumpList2\TestFile1.txt
文件 0 2010-06-03 23:38 JumpList2\JumpList2\TestFile2.txt
文件 0 2010-06-03 23:38 JumpList2\JumpList2\TestFile3.txt
文件 893 2010-06-03 21:01 JumpList2\JumpList2.sln
文件 10240 2010-06-03 23:27 JumpList2\JumpList2.suo
相关资源
- 《Visual Prolog 集成开发环境(下)》
- 清翔电子MCS51开发板资料_新版 01_开发
- 由浅入深,蓝牙4.0/BLE协议栈开发攻略
-
Windows em
bedded Compact 2013 应用开发调 - 为什么工程师要掌握FPGA开发知识?
- Quartus II 15.0中仿真Altera三速以太网I
- 周立功开发板ProASIC3实验-syn_FIFO代码
- 模糊PID控制 c
- STM32f103超声波模块例程
- 最新版TTF16.OCX Formula One v. 6.1.6.2 控件
- VirTest5.0.rar
- LCD显示温度+串口接收温度.rar
- 图像的小波包分解
- 数字华容道
- VisualStudioUninstaller vs卸载工具
- 基于MSP430G2553的蓝牙控制小车
- 金蝶K3wise数据字典
- DAC0832波形发生器幅值及频率都精确可
- 安卓QQ6.71协议源码易语言,qq协议源码
- E盾偷后台工具源码
- Zprotect专业版(无限制) 一机一码E
- WPF USB 网络 串口 通信软件
- Servlet API中文文档
- 组态王驱动开发包3.0.0.7(中文)
- stm32f030 IAP Demo(原创)
- 用python编写的移动彩信的发送程序
- SSM+Shiro+redis实现单点登陆
- 飞思卡尔单片机MC9S12XS12G128驱动(硬件
- 多窗口后台鼠标连点器
- jstl-api-1.2和jstl-impl-1.2
评论
共有 条评论