?
Solved

registery

Posted on 1998-01-09
2
Medium Priority
?
265 Views
Last Modified: 2013-11-20
when we use setregisterkey("myplace");
we get a place under HKEY_CURRENT_USER, Software,
myplace, "app title".

question 1, can I make the last dir "app title"  any arbitrary text
without changing the actual app.title. ?

question 2, this is under current user, so what if some other user
logs in and want to access this  same information ?
How to write to  a common place for the machine for all users ?

0
Comment
Question by:hasmet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
anichini earned 200 total points
ID: 1313675
1) use CWinApp:m_pszProfileName - be sure to put this code AFTER the call to SetRegistryKey:

//First free the string allocated by MFC at CWinApp startup.
//The string is allocated before InitInstance is called.
free((void*)m_pszProfileName);
//Change the name of the .INI file.
//The CWinApp destructor will free the memory.
m_pszProfileName=_tcsdup(_T("d:\\somedir\\myini.ini"));

Note   If you assign a value to m_pszProfileName, it must be dynamically allocated on the heap. The CWinApp destructor calls free( ) with this pointer. You many want to use the _tcsdup( ) run-time library function to do the allocating. Also, free the memory associated with the current pointer before assigning a new value. For example:

2) You want to put stuff that's common to all users in HKEY_LOCAL_MACHINE/Software/yourplace/profile. Unfortunately, MFC doesn't have any handy utility routines for accomplishing this, so you have to use the API registry functions - look in the SDK docs for RegOpenKeyEx and it's companions.



0
 
LVL 2

Expert Comment

by:anichini
ID: 1313676
Oh, and I realize the code says "change the name of the INI file" but trust me, it'll affect the registry key!

0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question