|
lucy wrote:
I thought there was a member variable of CWindow which I can change directly. I am wrong.
I am not aware of any CWnd member for this. Add your own and then in
your OnInitDialog() call SetWindowText().
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Oops, cannot use SetWindowText() in OnInitDialog. Assert failure since the m_hWnd is null. What should I do?
|
|
|
|
|
Hi Lucy,
You should be able to use SetWindowText() on OnInitDialog without this ASSERT. Are you calling it before CDialog::OnInitDialog(); - cause it needs to be after it. I checked the following and it works:
<br />
BOOL CLucyDlg::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
<br />
SetWindowText(m_strDlgTitle);
return TRUE;
}<br />
Hope this helps, let me know if your ASSERT still shows its ugly head...
Dylan Kenneally
London,UK
|
|
|
|
|
got it. Now I am done. Thank you, Dylan.
|
|
|
|
|
I was looking at the SQL Server index adding dialog boxes and came across their ListCtrls that implement a drop down for every row.
I was wondering if there is a sample code implementing similar to that anywhere.
To be clear, I would like to be able to click on a listctrl and have it show a drop down menu from which the users can select.
thanks
|
|
|
|
|
|
Anyone know anything about this message? Is it useful for anything besides very simple horizontal toolbars?
I was thinking of using it to simplify my layout calculations, but it doesn't seem to be smart enough to take window size into account.
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
Since it retrieves the total size of all of the visible buttons and separators in the toolbar, then the use I think is to construct a pager control, a control where you don't have all the size to show all the toolbar buttons , then you implement a walking right and left arrow to show the next controls on the toolbar ... apart from that I don't known to use it
Cheers,
Joao Vaz
The Most Unhappy and Frustrated TCL programmer,besides that a Happy guy
|
|
|
|
|
It's very useful to set the ideal width in ReBar controls
|
|
|
|
|
Anonymous wrote:
set the ideal width in ReBar controls
Of course, why don't I thought this sooner , almost one year ago that would help me, but now with TCL
But even so thank you for sharing the tip
Cheers,
Joao Vaz
The Most Unhappy and Frustrated TCL programmer,besides that a Happy guy
|
|
|
|
|
Thank you both for your information. After months of wrestling with MFC's toolbar code AND STILL NOT GETTING IT RIGHT, i think i'll go with ReBar and use this then. To quote a sig, "Simplicity Rules"
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
Shog9 wrote:
After months of wrestling with MFC's toolbar code
Exists a very good resource on this ...a book called MFC Internals, getting a bit old, but nevertheless a great resource
Cheers,
Joao Vaz
The Most Unhappy and Frustrated TCL programmer,besides that a Happy guy
|
|
|
|
|
Joao Vaz wrote:
a book called MFC Internals
Hmm, i'll check it out. Thanks again!
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
You wouldn't regret it !!!!
Cheers,
Joao Vaz
The Most Unhappy and Frustrated TCL programmer,besides that a Happy guy
|
|
|
|
|
is there no simple way to delete a registry key? i have been looking and it seems it takes 20 lines of code just to delete a key..
i use :
WriteProfileString("Settings", "name", strName);
to store it, is it really that hard to remove it?
thanks for your advice!
-dz
|
|
|
|
|
LONG RegDeleteKey(
HKEY hKey, // handle to open key
LPCTSTR lpSubKey // subkey name
);
That's the function I use!
Al
|
|
|
|
|
well part of the problem is that i dont know the HKEY, the WriteProfileString() function takes different values, and I'm not sure how to find out what the HKEY is, is there a command to get it somehow?
thanks for the responce!
-dz
|
|
|
|
|
You could open the registry with:
LONG RegOpenKeyEx(
HKEY hKey, // handle to open key
LPCTSTR lpSubKey, // subkey name
DWORD ulOptions, // reserved
REGSAM samDesired, // security access mask
PHKEY phkResult // handle to open key
);
And the delete it with:
DWORD SHDeleteKey(
HKEY hkey,
LPCTSTR pszSubKey
);
Or:
LONG DelRegTree(
HKEY hParentKey,
const CString& strKeyName
);
However yoiu need the HKEY you can open it to get the HKEY with the SubKey from WriteProfileString()
Oh! Are you asking in MC++? You see I don't know if this question is for MC++ or C++ because we don't have a MC++ forum ... yet
So if you are using MC++ remember to
[DllImport("user32.dll")]
Joke a part, hope this help. That's all I know about the registry, somebody else may be able to help
|
|
|
|
|
I guess you refer to the inability of RegDeleteKey to delete keys recursively in NT/2000/XP (the same function recursively deletes keys in 95/98/ME). The function <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/Shell/reference/shlwapi/registry/shdeletekey.asp">SHDeleteKey</a> , on the other hand, deletes keys in a recursive manner for both families of OSs --and it's only one line of code.
Caveat: SHDeleteKey is not present in 95 and NT 4.0 systems without IE 4.0 or higher. It is provided by default in later OSs.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I must not be phrasing something right.. i have a variable in the registry 'key' under the following path:
HKEY_CURRENT_USER/Software/DeveloperName/Program/Settings/
the value is called 'UserName' and it is set to a string
to set this value i call:
WriteProfileString("Settings", "UserName", "Fred Smith");
I cannot figure out how to use the RegDeleteKey() function because it takes an HKEY variable type, how do i find out this value? i have tried passing the path and the value to delete, but that doesnt work..
hope that clarifies?
-dz
|
|
|
|
|
HKEY myKey;
LONG RegOpenKeyEx(HKEY_CURRENT_USER,
"/Software/DeveloperName/Program/Settings/",
0,
0,
&myKey);
And the delete it with:
DWORD SHDeleteKey(HKEY myKey,
"/Software/DeveloperName/Program/Settings/"
);
To delete a value is something like:
LONG RegDeleteValue(
myKey, // handle to key
LPCTSTR lpValueName // value name
);
Hope this helps!
Al
|
|
|
|
|
I must not be phrasing something right
Yep, I misundesrstood your question. sorry. If I got it now, the way to delete a given key is by calling RegDeleteKey like this:
::RegDeleteKey(
HKEY_CURRENT_USER,
CString(AfxGetApp()->m_pszRegistryKey)+"\\"+AfxGetApp()->m_pszProfileName+"\\Settings\\UserName"); (Sort of, I haven't tested it.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I tried your solution, as well as Pascal's, neither give any errors, but neither delete the key.. i traced the string before calling the RegDeleteKey() and the path looks exactly as it does in regedit, but the key never gets deleted..
-dz
|
|
|
|
|
!! I don't have any compiler handy, but I'll give this a try tomorrow morning (CET) and tell you back (in case you haven't found the solution yet.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
This is the shortest solution I found (it really works, I tried it):
HKEY hKey=NULL;
::RegOpenKeyEx(
HKEY_CURRENT_USER,
CString("Software\\")+AfxGetApp()->m_pszRegistryKey+"\\"+AfxGetApp()->m_pszProfileName+"\\Settings",
0,KEY_WRITE,&hKey);
::RegDeleteValue(hKey,"name");
::RegCloseKey(hKey);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|