keeping list control item #2

hello
I am a beginner, in programming.
i have made a list control in which i keep items. how can  i make the list 
control to retain the values even when i quit the program

thanks 


0
dspman (15)
7/21/2006 11:28:53 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
591 Views

Similar Articles

[PageSpeed] 30

At the point of exit:

for(int i =0; ; i++)
    { /* clear Registry */
     // delete the value
     //   HKEY_CURRENT_USER\Software\MyCompany\MyProgram\SavedValues\Whatever\i
     // where the key is created by CString::Format
     /// if the operation fails because the key doesn't exist, exit the loop
   } /* clear registry
for(int i = 0; i < c_Whatever.GetCount(); i++)
     { /* save items */
      CString s;
      c_Whatever.GetLBText(i, s);
      // Write the registry value
      // HKEY_CURRENT_USER\Software\MyCompany\MyProgram\SaveValues\Whatever\i
     } /* save items */

Note that the choice of calling the Registry key "SavedValues" and using the name
"Whatever" (which is presumably based on the name of the control I used, c_Whatever) are
purely arbitrary decisions, and of course, you would use CString::Format to create that
string with %d in place of i and thus get the value i there

You can download my set of Registry support files from my MVP Tips site, because there are
problems with writing to the Registry if you just give a long key; all the steps have to
already exist, so you first have to create
	HKEY_CURRENT_USER\Software\MyCompany
then create
	HKEY_CURRENT_USER\Software\MyCompany\MyProgram
and then create
	HKEY_CURRENT_USER\...as above...\SaveValues
and then create
	HKEY_CURRENT_USER\...as above...\Whatever
before you can start writing the values based on the rendering of the binary counter i. My
library will create these steps if they don't exist, which is why I use it everywhere I
use the Registry.

Now, at the point where your program starts up, you just do
for(int i = 0; ; i++)
   { /* read strings */
    // read the value
    // HKEY_CURRENT_USER\...as above...\Whatever\i
    // where i is formatted using CString::Format with %d
    // if the value fails to load, exit the loop
    c_Whatever.AddString(s); // where s is the string you just read
   } /* read strings */

				joe
      
On Fri, 21 Jul 2006 11:28:53 -0000, "dspman" <dspman@dspman.com> wrote:

>hello
>I am a beginner, in programming.
>i have made a list control in which i keep items. how can  i make the list 
>control to retain the values even when i quit the program
>
>thanks 
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
7/24/2006 6:18:07 PM
Reply:

Similar Artilces:

How do I restrict only 1 of 2 check boxes be checked?
I have 2 check boxes in an excel worksheet, and I would like to restrict it so only one can be check at a time. So, if 1 on them is checked, and you try to check the other one, a warning will pop up to stop you. You could use code to restrict this, however what you should use are the option buttons, they were made for this Regards, Peo Sjoblom "Board" wrote: > I have 2 check boxes in an excel worksheet, and I would like to restrict it > so only one can be check at a time. So, if 1 on them is checked, and you try > to check the other one, a warning will pop up t...

Keep advertising out of software
Microsoft puts ads for its products in services in Money, which is bad enough. Now I read they are going to put advertising in other software as well. Please don't. I guess this is what happens when you own a monopoly. ...

How do I alphabetize a list of names?
How do I alphabetize a list of names in Excel? Select the list of names and then click the Sort button on the standard toolbar, or choose Sort from the Data menu. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "k8k" <k8k@discussions.microsoft.com> wrote in message news:69B8ED31-39EE-46B7-BCE8-5A702A92D0CD@microsoft.com... > How do I alphabetize a list of names in Excel? ...

quick cash #2
Send this post to a friend GET $40,000 WITH ONLY 6 BUCKS!!! THIS IS NOT A SCAM!!! I DID IT AND IR WORKS! Original post: A while back, I was browsing these newsgroups, just like you are now, and came across an article similar to this that said you could make thousands of CASH within weeks with only an initial investment of $6.00 plus stamps! So I thought, "Yeah, right, this must be a scam!" But like most of us I was curious and kept reading. It said that if you send $1.00 to each of the 6 names and addresses listed in the article, you could make thousands in a very short period of ti...

Turn off Analytical Accounting Edit List if not used (Payable modu
We purchased the AA (Analytical Accounting) module, installed it, but have not yet implemented it (will in a couple of months). So, when we put through a payable transaction, and then print the reports after that, 2 reports come out: 1. the Payable Transaction Edit List and 2. Analytical Accounting Edit List. As you can tell, because we haven't implemented it, the AA reports mean nothing. So, now I just tell people when that report comes up to uncheck all the print destinations. I asked our GP consultant about this and basically thought that it was offered in the Tools>>Po...

Text Values #2
I'm tryng to build a spreadsheet to track employee vacations. How do I sum 8 hours if a cell has a "V" entered and 4 hours if a cell has an "X" entered? Assuming you're using column A, and each row is either the number of hours worked, or a V or a X, then use a helper column, B, and insert this in B1 and copy down.......change the A1's to A2's if you have a header in Row 1, and put this in B2. =IF(A1="V",8,IF(A1="X",4,A1)) Vaya con Dios, Chuck, CABGx3 "Brando" <carpenterchsd@earthlink.net> wrote in message news:1113...

windows installer keeps popping up
windows installer keeps popping up to install microsoft money express 2002. please , how do i make it stop. I have tried all functions to make it quit, but "another application is running, close that one first pops up. Try the following article: http://support.microsoft.com/default.aspx?scid=kb;en-us;315113&Product=mny "Roy" <hillstromrk@msn.com> wrote in message news:0a9b01c38c64$05fcfcf0$a101280a@phx.gbl... > windows installer keeps popping up to install microsoft > money express 2002. please , how do i make it stop. I > have tried all functions to make...

Phantom email #2
I get new message alert in my toolbar; unopened envelope. But when I launch Outlook, there is no new mail in the inbox. Any ideas, anyone? Paul anonymous@discussions.microsoft.com <anonymous@discussions.microsoft.com> wrote: > I get new message alert in my toolbar; unopened envelope. > But when I launch Outlook, there is no new mail in the > inbox. Have you checked any other folder, like Delete Items or Junk E-mail? Perhaps you have a rule deleting the mesage or moving it to another folder. -- Brian Tillman ...

Item() method
i'm working with Outllook 2003 and try to write a small plug-in/exe which gets the folder's info. (in C#.Net). however, when i conpiled, i got an error saying "'Outlook.Folders' doesn't contain a definition for 'Item'". i look into the object browser and the Folders.Item is no longer available. here's my code sample: Outlook.NameSpace objNs = oOutlook.GetNamespace("MAPI"); Outlook.MAPIFolder objMAPI = objNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts).Folders.It em("Sales"); this same piece of code was running in...

Money 2003 problem #2
I started reconciling bank account and clicked postpone so I could finish later. When I went back to finish, I get an error message that says <AC206> is not a valid interest amount. Since I clicked postpone and I had already entered the interest amount, now that box is dim and I can't change the <AC206> that's in there. In other words, how do I continue reconciling after clicking postpone? You should have a transaction in the register for the interest. Can you delete that outside of the balancing function? "Anna" <anonymous@discussions.microsoft.com...

"OWA was unable to get to your inbox" after moving mailbox to ES2K #2
We are upgrading ES5.5 to ES2K with a new server. After moving mailbox from ES5.5 to the ES2K server, the mailbox shows the correct new home server in the Global Catalog in Exch Admin 5.5, but when users try to login to our OWA 5.5 they get the message "OWA was unable to get to your inbox". We are moving mailboxes incrementally to reduce impact on production, but users will still need to access OWA while the migration is in progress. Do we need to set up a second OWA instance, or is there a way to tell OWA 5.5 where to look for the mailbox on the ES2K server? You will need to conne...

Footer Date Format #2
Hi Is it possible to change the format of Date in the Header/ Foote Say, from the default M/D/YYYY to DD/MMM/YYY Than Sachin Hi AFAIK not directly possible. But you may use the following macro (put it in your workbook module - not in a standard module): Private Sub Workbook_BeforePrint(Cancel As Boolean) Dim wkSht As Worksheet For Each wkSht In Me.Worksheets With wkSht.PageSetup .CenterFooter = Format(date,"DD/MMM/YYYY") End With Next wkSht End Sub -- Regards Frank Kabel Frankfurt, Germany Sachin wrote: > Hi! > > Is it possible to change the...

Cannot install CRM Server 1.2
I am trying to install CRM Server 1.2 on a machine with Windows Enterprise Server 2003. I get the following error message: You must be a member of the Domain Admins group to install CRM Server. I am unfamiliar with the administrative issues so I could be asking some dumb questions. I have signed on as the Administrator and the Administrator is a member of the Domain Admins group. What can I do to find the problem? I have gone through the list of previous posts that have a similar issue, but have be unable to apply it to this situation. I appreciate any advice in this matter. Regards Chris...

Restricted Stock Grant #2
In Jan '08 I received Restricted Stock Grant from my employer which vest over 3 years. I searched through MSMoney help and was unable to find any assistance on how to enter stock grants. So I would like to document how I think I will have to enter the grant myself and get feedback from members on this group who know much more than me about MSMoney... 1) Enter the total number of shares granted as a stock option with 3 year vesting with a cost basis of $0. 2) Each year 1/3 of them vest and I will be taxed on that portion as ordinary income. At this point I have 2 choices: 3a) Have ...

Adding attributes to product list of equipment
It has always worked before, but now it fails and I get an error, "An error as occured. For more information contact your system administrator" (ME) Not much information to go on. Both the CRM server and SQL have been rebooted and critical updates applied, Any ideas? -- John G That error could mean other issues but I got it a few times where I had installed the Rollup 1 and it involved specifically this hotfix: http://support.microsoft.com/default.aspx/kb/912061/en-us I was able to resolve in all cases by following the steps in respect to the Microsoft.crm.MetadataService.d...

Wrong Total in Account List in Money 2004
I been using Money since 2003 to keep all my finances and have really liked it. But recently (a week ago), Money has started messing up my account totals. The totals in the individual accounts (the transaction register) are correct, but when I go to Account Lists to see a summary of all my accounts, the totals are wrong. I have tried looking around, but have had no luck figuring it out. Any help would be great... In microsoft.public.money, Dustyn wrote: >I been using Money since 2003 to keep all my finances and >have really liked it. But recently (a week ago), Money >has st...

Copy colors from [excel 97 SR-2]
"Copy colors from" drop down menu is not working. Any ideas? Patches? Where is this menu item? (It's been a long time since I've used xl97 and I don't recognize it in xl2003.) Fan924 wrote: > > "Copy colors from" drop down menu is not working. Any ideas? Patches? -- Dave Peterson Mine is not woriing on either machine I have it on? From help topic _________________________________________________________________ Copy a color palette to another workbook 1 Open the workbook that contains the color palette you want to copy. 2 Switch to the workbook ...

Outlook 2003 Crashes during send/receive #2
I have uninstalled and reinstalled with same result. (No error code Only a message that Outlook must close, sorry for the inconvenience) My welcome screen still indicates unread messages although Outlook i uninstalled. Can I remove all registry entries for Outlook? Curren user, Local machine, etc., then reinstall? I have tried unistallin all of Office 2003 as well and Outlook came back with all my dat intact, and consequently the same conditions -- terco ----------------------------------------------------------------------- tercor's Profile: http://www.officehelp.in/member.php?us...

Need Help #2
All, When outlook 2000 running in idel mode, i get the following message: the procedure entry point STRTOKEX could not be located in the dynamic library MDSERT2.dll Please help with troubleshooting this problem. Thanks. ED ...

Printing Problem #2
I am having problems with printing my messages from outlook. All the other apps print fine except for Outlook. It prints but the left margin is so close to the edge of the paper that it chops off characters. I have looked everywhere but dont have an option to change this. Any ideas how I can fix this. Thanks Sunil Prasad sunilprasad@dccnet.com ...

JoAnn #2
Since you have Office Beta, try this for me. Select a side folded card, put a WordArt on page 1 and 4. In print preview are they upside down? If you can, print the card, does both sides print? Can you create a custom size booklet? If you can, when you print preview, are there crop marks? I really hate the way the page setup is designed. I setup the printer for a custom size booklet but Publisher will not accept it. Every time I choose the booklet option, Publisher defaults to letter size. It matters not what printer I use. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msau...

can i find out what cells are linking to other workbooks? #2
that did the trick, thanks a lot Frank, and i would reccommend this file to anyone else -- ForSal ----------------------------------------------------------------------- ForSale's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1189 View this thread: http://www.excelforum.com/showthread.php?threadid=27261 ...

Creating array for three items
Hello all, I am reading 3 strings from a DB table. I need to apply the same process to all three strings, so I figured that I would use a for loop. To make the loop easier to handle I am going to put the three strings into an array so I can loop through each one, something like this: dim sArr() as string redim sArr(0) sArr(0) = string 1 redim preserve sArr(1) sArr(1) = string 2 redim preserve sArr(2) sArr(2) = string 3 for each sItem as string in array 'process here next That seems simple enough, except that any one of the strings might be empty. I could ...

E-Mail Received directly to Deleted Items Folder
I am receiving e-mail confirmation from a state government that does not have a send from address. when Outlook receives the e-mail it is sent directly to my deleted items folder. Any ideas on how to have it go to in box folder? ...

Outlook 2002 XP #2
Having problems sending email due to a missing mailmapi.dll file. Where can I download this dll file and where on my computer do I download this file???? Thanks in advance for any help Dan Can you post the exact error message "dan243" <dan243@email.msn.com> wrote in message news:edsg8HczDHA.1676@TK2MSFTNGP12.phx.gbl... > Having problems sending email due to a missing mailmapi.dll file. Where can > I download this dll file and where on my computer do I download this > file???? > > Thanks in advance for any help > Dan > > This may help go to Contro...