|
HI
Samples are availble in MSDN CD under \SDK\Graphics
KK
|
|
|
|
|
Hi Geniuses,
I saving the toolbar status of my MDI application using SaveBarState (_T("TBStatus")). It works fine. It stores the status in the registry here:
HKEY_CURRENT_USER\Software\Local AppWizard-Generated Applications\MyApp\TBStatus
I want the status to be stored in some other place, specifically here:
HKEY_LOCAL_MACHINE\SOFTWARE\MyApplication\TBStatus
Where "HKEY_LOCAL_MACHINE\SOFTWARE\MyApplication" is the installation entry.
My aim is to remove the toolbar status entry from the registry while uninstalling the application.
If anybody could suggest me a solution, I would be grateful.
Thanks in advance,
Sarvan AL
|
|
|
|
|
|
Hi Nibu,
The SetRegistryKey always stores under "HKEY_CURRENT_USER\Software". But I want to store in "HKEY_LOCAL_MACHINE\SOFTWARE\MyApp". I am using Win2000. But it needs to be done in Win98 and WinXP too.
Is there anyother alternative?
Thanks for your interest.
Sarvan AL
|
|
|
|
|
|
Sarvan AL wrote: Is there anyother alternative?
From the Docs:
If you assign a value to m_pszRegistryKey , 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:
free((void*)m_pszRegistryKey);
m_pszRegistryKey=_tcsdup(_T("HKEY_CURRENT_USER\\Software\\mycompany\\myapp\\thissection\\thisvalue"));
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Hi Nibu,
Changing "m_pszRegistryKey" value, remains under the hierarchy "HKEY_CURRENT_USER\Software\". If I set this member variable with "HKEY_CURRENT_USER\\Software\\mycompany", the toolbar status is here:
HKEY_CURRENT_USER\\Software\\HKEY_CURRENT_USER\\Software\\mycompany
It not at all changing the root. It has same functionality of SetRegistryKey(..).
Kindly suggest me a path to go ahead.
Sarvan AL
|
|
|
|
|
The root is hard coded. So it will be fixed. One option is to override the GetAppRegistryKey function of CWinApp . The root key is hard coded here. So overriding it and returning a valid key (i.e. your key) will help.
Note: From here on this will be the default key for the application.
The function signature is as follows:
HKEY GetAppRegistryKey();
This is the function that returns the valid key to the application. Only problem being that it's not a virtual function. So if you start using it from a derived class casted to a base class it won't work.
So calls like AfxGetApp()->WriteProfileString(...) won't work as it will call CWinApp implementation. Cast it to appropriate class and use it.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Hi Nibu,
Since I am a newbie to Windows Registry Handling, I am not able to grasp the things exactly. If you could explain me in detail, I'd be grateful. I'd like to know, what is happening behind HKCU and HKLM. Is it very hard to make the UI settings common to all the users?
Thanks for spending your precious time for me.
Sarvan AL
|
|
|
|
|
Sarvan AL wrote: Since I am a newbie to Windows Registry Handling
Then it's trouble. You'll have to learn first. Coz registry is very sensitive to changes. Any wrong action is catastrophic. It could take the entire OS down.
Sarvan AL wrote: I am not able to grasp the things exactly
Only in the beginning.
Sarvan AL wrote: I'd like to know, what is happening behind HKCU and HKLM.
Nothing special is going on.
Sarvan AL wrote: Is it very hard to make the UI settings common to all the users?
Not at all. But first learn how to work with the registry.
Microsoft has provided this set of functions(WriteProfileString is one of them) so that users don't have to break their head writing and reading values from the registry. There are some easy functions for manipulation of registry. Look at what Ganesh said.
All the best.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Hi Nibu,
I really agree with you. As you said, Windows Registry is very sensitive. That's why I didn't want to do anything trial and error. Let me learn the basics first.
Thanks for your suggestion.
Sarvan AL
|
|
|
|
|
Sarvan AL wrote: Let me learn the basics first.
Great! It's very easy. I would recommend open up the registry and see what is inside and understand why it is there.
Sarvan AL wrote: As you said, Windows Registry is very sensitive.
Yes it is! But it's a safe approach to use WriteProfileString ,... and others in that group.
Sarvan AL wrote: That's why I didn't want to do anything trial and error.
Never! First Back Up
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
Use RegCreateKey to creaet the key under any root. Just you have to specify
HKLM_LOCAL_MACHINE and other parameters
You can set values by RegSetValue or RegSetValueEx
Cab get value by : RegQueryValue or RegQueryValueEx.
you can ermove entry by RegDeleteKey and RegDeleteValue.
Cheers
"Peace of mind through Technology"
|
|
|
|
|
would you please tell me how to set the meflexgrid cell wordwrap?
CMSFlexGrid m_flexgrid;
though I add "m_flexgrid.SetWordWrap(true);" in the code add set the msflexgrid wordwrap true in property tabel, It still can't work.
why?
|
|
|
|
|
i found it can work with only where there is a space" ";
such as CString str="afasdfwe adf adsf efs dfe asfe af";
wordwrap occurs at the space character" ";
if the CString str ="adfasdfewfwegfregergruwergrgqa";
why can't the wordwrap function work?
|
|
|
|
|
zeus_master wrote: if the CString str ="adfasdfewfwegfregergruwergrgqa";
Where should it break?
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
anywhere, depends on the width of the cells?
|
|
|
|
|
Hi ,
From the below code it displays the file name on the output screen,can anyone please tell how to add them to List box ??
I have list box IDC_OUTPUT CListCtrl m_output.
-----------------------------------
if (e != NULL) {
readFiles (e->left);
fp = fopen (e->filename, "r");
fnum++;
if ((s = (char*)strrchr(e->filename, '/')) == NULL)
cout << e->filename; //Prints file name
else
cout << e->filename; //Prints File name
insert (fnum, e->filename);
if (fp) {
wds = getWord (fp,fnum);
}
cout << " (" << wds << " words)" << endl; //Prints number of words
fclose (fp);
------------------------------------
Regards,
Parichay.
|
|
|
|
|
hi parichaya,
u want to add to ListBox or ListControl?
r u from AP?
|
|
|
|
|
Hi,
its List Control.
I am from Bangalore.
|
|
|
|
|
hii,
where r u working in b'lore?
|
|
|
|
|
Hey i am nt working,i am doing my MCA project work.
|
|
|
|
|
good.
may i know on which project u r doing?
ur name?
|
|
|
|
|
|
Hi,
Thanks for the reply,
its CListCtrl,
|
|
|
|