資源簡介
本代碼是C語言實現操作注冊表,實現關聯指定的后綴名和打開程序。本代碼的講解在http://blog.csdn.net/arvon2012/article/details/7818909
代碼片段和文件信息
//?關聯后綴名和打開程序
//?edit:Arvon
//
//本代碼中通過操作注冊表實現后綴名:.seve和打開程序Opo.exe的關聯
#include?“stdio.h“
#include?“windows.h“
#include?“malloc.h“
int?main(int?argc?char?*argv[])
{
HKEY?hKey;
//create?.seve
if?(ERROR_SUCCESS!=RegCreateKey(HKEY_CLASSES_ROOTL“.seve“&hKey))
????{
????????printf(“創建子鍵失敗!\n“);
????????return?0;
????}
????else
????{
????????printf(“create?.seve!\n“);
????}
RegCloseKey(hKey);
if(RegOpenKeyEx(HKEY_CLASSES_ROOTL“.arv“0KEY_ALL_ACCESS&hKey)!=ERROR_SUCCESS)?
????{
????????printf(“創建HKEY失敗!\n“);
????????return?0;
????}
//set?value
LPCWSTR?szValueName1?=?L““;
LPCWSTR?szValueDate1=L“opofile“;
UINT?cbLen=wcslen(szValueDate1);
if(RegSetValueExW(hKeyNULL0REG_SZ(const?unsigned?char?*)szValueDate1cbLen*2)=
- 上一篇:opencv背景差分
- 下一篇:16位 CRC 校驗代碼
評論
共有 條評論