Hi all!!
I am trying to save the subkeys and values of a key in a text file and i am not getting the result. the file created has not a recognizable name and there is nothing stored in it.. so please help me in this....thanx
here is the code:
// recent.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "recent.h"
#include<conio.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else
{
HKEY hTestKey;
if(RegOpenKeyEx( HKEY_CURRENT_USER,TEXT("SOFTWARE\\Microsoft\\Internet Explorer\\Settings"),0,KEY_READ,&hTestKey) == ERROR_SUCCESS )
{ cout<<"Into the registry"; getch();}
LPCTSTR name=(LPCTSTR)"mydata.txt";
if(RegSaveKey(hTestKey,name,NULL))
cout<<"file loaded";
getch();
}
return nRetCode;
}