• 大小: 2KB
    文件类型: .c
    金币: 1
    下载: 0 次
    发布日期: 2021-06-07
  • 语言: C/C++
  • 标签: 关联  后缀  打开  VC  C  

资源简介

本代码是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)=

评论

共有 条评论