void open_key(HKEY* Key , HKEY key , LPCTSTR subkey)
{
	cout << Key[1] << endl;
	RegOpenKeyEx(Key[1] , subkey , 0 ,  KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE  , &key);
}

int main()
{
HKEY keys[] = {HKEY_CLASSES_ROOT , HKEY_CURRENT_USER , HKEY_LOCAL_MACHINE , HKEY_USERS , HKEY_CURRENT_CONFIG};

open_key(&keys[1] , hkey , "Software");
}

how can i print Key[1] so that its show HKEY_CURRENT_USER ?
now it just prints: 0x80000002

Is that what HKEY_CURRENT_USER is defined to? I'm not going to check for you but I suspec that it is. You would need to provide some method of producing a textual representation of this defined value and printing that instead of the value itself.

I agree with matt, HKEY_CURRENT_USER is just a const value or enumerated type, so you would need something like a switch case statement to cout the textual representations

ok,if i dont need string representation,i just want to pass it to regopenkeyex(),how should i do it ? because is not working....:(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.