Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Registry editing...

Status
Not open for further replies.

vlitzer

Programmer
Apr 30, 2002
31
AR
hi there... i having some trouble understanding the registry editing/reading functions that i've found in the MSDN on the web. How really works? does anyone have a "clear" example?. Thanks anyway!
 
I'm really just getting started with MS C++ 6.0.
Here is an example of how I populated the registry with a
string value. It's fairly simlar with an int value.
I still cannot work out how to store a datetime? I am thinking of resorting to converting the datetime to int or strings then storing it. If you find out let me know.

//This is a small sample which writes a

CWinApp *pApp = AfxGetApp();

CString strSection = "RegistryFolderName";
CString strStringItem = "Application Dir";
CString s_application_dir = "Value in the registry";

// Set the Application Directory String
// If it does not exist creates a new string
pApp->WriteProfileString(strSection,strStringItem,s_application_dir );

// Get the applcation string from the registry
s_application_dir = pApp->GetProfileString(strSection, strStringItem);


Cheers
MJ.
 
Try ShGetValue and SHSetValue for direct access to registry. Of course, this won't teach you squat, but if you insist on MSDN, try as well, RegOpenKeyEX and all related functions.

You have to be carefull with all the parameters you submit to the functions, as you might be spending whole nights wondering just why some data does not get written into the registry.

If you don't need very much, use the first two functions I wrote above. It might help. [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top