RegCreateKeyEx Error

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <string>
#include <Windows.h>

using namespace std;

int main()
{
	cout << "Trying to open the reg key...";
	HKEY hKey;
	LPDWORD result;
	RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\SEnergy\\PKL", 0, NULL, REG_OPTION_NON_VOLATILE,  KEY_READ | KEY_SET_VALUE, NULL, &hKey, result);
	if(result == REG_CREATED_NEW_KEY)
	{
		cout << "New Key \"Software\\SEnergy\\PKL\" has been created successfully!";
	}
	cout << endl;
	system("pause");
	return 0;
}


1
2
3
1>c:\users\senergy\documents\visual studio 2012\projects\pkl\pkl\source.cpp(13): error C2446: '==' : no conversion from 'long' to 'unsigned long *'
1>          Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\senergy\documents\visual studio 2012\projects\pkl\pkl\source.cpp(13): error C2040: '==' : 'unsigned long *' differs in levels of indirection from 'long'


http://msdn.microsoft.com/en-us/library/windows/desktop/ms724844(v=vs.85).aspx

LPDWORD lpdwDisposition


so how do I have to use it?

also how do I request admin access when the program starts?
Like this:
1
2
DWORD result;
	RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\SEnergy\\PKL", 0, NULL, REG_OPTION_NON_VOLATILE,  KEY_READ | KEY_SET_VALUE, NULL, &hKey, &result)


Last edited on
Topic archived. No new replies allowed.