Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

registery

Posted on 1998-01-09
2
Medium Priority
?
268 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

610 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