Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Nymphodora), 972 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
c++ , how to delete a binary key in the registry #349175
12/04/10 16:23
12/04/10 16:23
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline OP
Senior Expert
ello  Offline OP
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
hi there,
can someone point me to how i can delete a certain binary entry in the registry? i can delete a whole key with its content but i cant find some example or info how to delete a certain binary entry...

for example how can i delete HKEY_LOCAL_MACHINE\\SOFTWARE\\MYKEY\\VALUE

thanks in advance,
ello

edit: ok, i found this RegDeleteKeyValue.. but how do i use it? i gent an error "error C2664: 'RegDeleteKeyValueW': Konvertierung des Parameters 2 von 'const char [33]' in 'LPCWSTR' nicht möglich"

this is how iwas trying it:
RegDeleteKeyValue(HKEY_LOCAL_MACHINE,"HKEY_LOCAL_MACHINE\\SOFTWARE\\MYKEY","VALUE");


Last edited by ello; 12/04/10 16:55.
Re: c++ , how to delete a binary key in the registry [Re: ello] #349180
12/04/10 17:43
12/04/10 17:43
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
put a L in front of the string

muffel

Re: c++ , how to delete a binary key in the registry [Re: muffel] #349183
12/04/10 18:30
12/04/10 18:30
Joined: Jul 2008
Posts: 894
T
TechMuc Offline
User
TechMuc  Offline
User
T

Joined: Jul 2008
Posts: 894
or make an ascii build instead of an unicode one..

Re: c++ , how to delete a binary key in the registry [Re: TechMuc] #349189
12/04/10 20:20
12/04/10 20:20
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline OP
Senior Expert
ello  Offline OP
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
thanks for you r help.. what could it be that the value isnt deleted? i have created the value manually in the registry for testing purposes and when i run my program the value still remains.

here is my complete code:
Code:
#include <stdio.h>
#include <tchar.h>
#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{

CHAR strLong[1024];
	LONG result;
	result = RegDeleteKeyValue(HKEY_LOCAL_MACHINE,L"SOFTWARE\\MYKEY\\",L"VALUE");

   printf(strLong, "%s", result);
   printf("\n");
   system("Pause");
return 0;
}



thanks in advance for any help

edit:
i tried another way
Code:
#include <stdio.h>
#include <windows.h>

int main()
{
	HKEY hkey;
	LONG result;
	result = RegOpenKey(HKEY_LOCAL_MACHINE, L"SOFTWARE\\MYKEY", &hkey);
	if(result==ERROR_SUCCESS) printf("key opened");
	RegDeleteValue(hkey, L"VALUE");
	RegCloseKey(hkey);
	system("Pause");
	return 0;
}


it seems that the key isnt even opened as the printf is not called.

any ideas??

Last edited by ello; 12/04/10 20:41.

www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
Re: c++ , how to delete a binary key in the registry [Re: ello] #349194
12/04/10 22:26
12/04/10 22:26
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline OP
Senior Expert
ello  Offline OP
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
hi there.. i have updated the code to get better info about the error
Code:
#include <stdio.h>
#include <windows.h>
int main()
{
	LONG result;
	result = RegDeleteKeyValue(HKEY_LOCAL_MACHINE,L"/SOFTWARE/MYKEY",L"VALUE");
	LPVOID lpMsgBuf;
	FormatMessage( 
		FORMAT_MESSAGE_ALLOCATE_BUFFER | 
		FORMAT_MESSAGE_FROM_SYSTEM | 
		FORMAT_MESSAGE_IGNORE_INSERTS,
		NULL,
		result,
		0, 
		(LPTSTR) &lpMsgBuf,
		0,
		NULL 
		);
	MessageBox( NULL, (LPCTSTR)lpMsgBuf, L"Error", MB_OK | MB_ICONINFORMATION );
	LocalFree( lpMsgBuf );

	return 0;
}



and i am getting "Das System konnte die angegebene Datei nicht finden"

any ideas??


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1