0
嗨,我正在检查SqlClass的GUID是在我的Test.dll但它没有给它成功,它失败的价值......这是什么错误的代码。如何查看课程ID是否已注册?
#include <windows.h>
#include <iostream>
using namespace std;
int main() {
HKEY hk;
long n = RegOpenKeyEx(HKEY_CLASSES_ROOT,TEXT("\\CLSID\\SqlClass"),
0,KEY_QUERY_VALUE, &hk);"
if (n == ERROR_SUCCESS) {
cout << "OK" << endl;
}
else {
cout << "Failed with value " << n << endl;
}
}
我试图这样也RegOpenKeyEx(HKEY_CLASSES_ROOT,TEXT( “\ CLSID \ 46A951AC-C2D9-48e0-97BE-91F3C9E7B065”), 0,KEY_QUERY_VALUE,& HK)
此代码的工作FINE
#include <windows.h>
# include <iostream>
using namespace std;
int main() {
HKEY hk;
long n = RegOpenKeyEx(HKEY_CLASSES_ROOT,
TEXT("\\CLSID\\{46A951AC-C2D9-48e0-97BE-91F3C9E7B065}"),
0,KEY_QUERY_VALUE, &hk);"
if (n == ERROR_SUCCESS) {
cout << "OK" << endl;
}
else {
cout << "Failed with value " << n << endl;
}
}
该值真的存在于注册表中的那条路径上吗? – sharptooth 2009-07-21 05:12:31
在第二个代码片段中,GUID必须包含在“{”和“}”中。看看其他GUID如何存储在注册表中。 – sharptooth 2009-07-21 05:59:13