Discussion Locked

Regestry editing in C++

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

can sum1 plz send me the code 4 C++ (borland 3) as to:

edit regestry (regedit) in C++ by clicking a button - plz - also:D - the code to apply DOS commands in C++ (borland 3 -agen)
thnx loadsa

regards,

Blou

2 replies

by jackofalltech

This is not a script-kiddie site, please ask your questions in adult english.

I'll need more info in order to answer. Do you want the Win32 API calls required to access the registry or do you want to know how to code the button event?

Ralph

by d-ced

You can try the following bit of code for editing the registry. This changes the Screen saver and wallpaper.

********************************

//---------------------------------------------------------------------------

#include
#pragma hdrstop

#include "setreg.h"
#include
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
HWND desktop_window_handle;

Registry = new TRegistry;
Registry->RootKey = HKEY_CURRENT_USER;
Registry->OpenKey("Control Panel\\Desktop", TRUE);

try {

Registry->WriteString("Wallpaper","c:\\winnt\\system32\\hack.bmp");
Registry->WriteString("WallpaperStyle","0");

Registry->WriteString("SCRNSAVE.EXE","c:\\winnt\\system32\\ssbezier.scr"); Registry->WriteString("ScreenSaveIsSecure","0");
}
catch (...)
{
ShowMessage ("Failed to hack registry");
}

Registry->Free();

// Get Windows desktop handle as window
desktop_window_handle = GetDesktopWindow ();
SystemParametersInfo ( SPI_SETDESKWALLPAPER, 0,
"C:\\winnt\\system32\\hack.bmp\0", SPIF_UPDATEINIFILE );
// asdf = UpdateWindow ( desktop_window_handle );
RedrawWindow ( desktop_window_handle, NULL, NULL, RDW_ERASE);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Application->Terminate();
}
//---------------------------------------------------------------------------

This discussion is closed to new replies.