|
I think you are just having difficulty in using the registry API.
|
|
|
|
|
Yeah, it can be a royal pain if you have no clue like this guy.
"We have done so much in the last 2 years, and it doesn't happen by standing around with your finger in your ear, hoping everyone thinks that that's nice." - Donald Rumsfeld
|
|
|
|
|
You two are evil.
I like it
--
The coolest game in the world: NHL Hockey[^]
|
|
|
|
|
My opinion pretty much matches what everyone else said.
To your support, if INI files were used, it would be much easier to back up the settings for a single program. If it's in the same folder as the program, that's one less piece of the program scattered all over your hard drive.
However, the registry is still a useful tool, because everything is in one place. I don't have to search all over my hard drive to figure out which file holds a certain program's settings. The registry also uses fewer files, so backing up all your programs' settings is easier. Also, two or more different software packages may need to use the same settings, so a central location is necessary.
|
|
|
|
|
wogerdoger wrote:
Why does Windows need a registry ?
COM
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|
|
Thought this might belong in the lounge!
Thanks for the good points and info (esp. Hockey for the spell-check example and "polymorhpic executables". I guess it borders on self-modifying code).
I have never used (As in personally edited) an .ini file and have never run Regedit or toyed with the Registry API (Though after reading up on it, It doesn't look that hard).
I liked the comments about "the inexperienced" "playing" with ini files or worse, the registry. My point here is the application should provide the interface (i.e Tools | Options) to change the program's user settings. Anyone who goes into a (.ini) file and "changes stuff" should expect the program to behave in a not-so-qhkwbefnlkjqw <Restore-Backup> manner. Hey I have Word…but IE doesn’t go looking for the “I have a Spell-checker” Key! Is it in the settings…?
Cheers for the feedback.
If sex is a pain in the ass, then your name must be Joe Woodbury or Jason Henderson!
|
|
|
|
|
Hi
Does anyone have any experience creating toolbars with CToolBar where the width of each button varies? If someone could point me in the right direction it would be great.
Thanks in advance
Richard
|
|
|
|
|
Use the TBSTYLE_LIST style for the bar, and BTNS_AUTOSIZE for the buttons. I don't know if you can have different-width buttons for toolbars that don't have TBSTYLE_LIST .
--Mike--
Ericahist [updated Oct 26] | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
I am trying to subclass all buttons in all my dialogs, i have tryed a couple of soluions but nothing works, i have always a temporary handle.
I've tryed with FindWindowEx with "Button" in the class parameter but it doesn't work.
Has anybody an idea on how can i subclass all the buttons in all my dialogs at runtime ?
|
|
|
|
|
Why are you doing this? Are your buttons dynamically created or placed there with dialog editor?
CHAIGNEAU wrote:
I've tryed with FindWindowEx with "Button" in the class parameter but it doesn't work.
Maybe it's case sensitive try BUTTON
If you just have buttons, you could enumerate each window and change it's WndProc as you go.
If your buttons are all within a particular range of COMMAND id's you could also iterate each button control using GetDlgItem()
HTH
Cheers
I'm drinking triples, seeing double and acting single
|
|
|
|
|
My buttons are placed there with dialog editor.
I want to subclass dynamically all buttons in my application to draw them as i want without put a variable member in all my dialogs.
The className parameter of the FindWindowEx function is not case sensitive and i've tryed "BUTTON",i also get the className of a button and put it in this parameters but it still doesn't work.
How can you enumerate each child window of a dialog and now it's a button and then subclass them?
I don't want to change it's WndProc but change his class.
Thanx for your reply.
|
|
|
|
|
Honestly the easiest way to accomplish OWNERDRAW buttons is to derive a class from CButton and override it's DrawItem() and then use class wizard to associate each button with a Control member variable, then change each variable type from CButton to CYourOwnButton and whola!!! all yer buttons should be drawn the way you want
If you insist on using a more dynamic approach you could just make all your command ID's fall within a certain range of values and call GetDlgItem() return it's handle and subclass the control this way. Why would you use this approach though? Are you using SDK only...? Or just for efficiency?
HTH
Cheers
I'm drinking triples, seeing double and acting single
|
|
|
|
|
I want to build a generic framework to subclass all buttons. I can't use classwizard because my purpose is to not modify the existing app and to integrate this framework with less code as possible.
|
|
|
|
|
CHAIGNEAU wrote:
I've tryed with FindWindowEx with "Button" in the class parameter but it doesn't work.
Define "doesn't work." How about a code snippet of how you are using this function. Maybe the control does not exist at the time of the call.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I use this function in the Onitidialog, it's work for Edit, combobox but not button, it returns a NULL HWND.
|
|
|
|
|
Ok, but how are you calling FindWindowEx() ? Have you verified with Spy++ that the button has the characteristics you are searching for?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
What do you mean by "characteristics" ? FindWindowEx takes the handle of the window (my dialog), the handle of the window after we search or NULL, the class name (Button) and the window name or NULL. I've got the class name of a button of my dialog and passed it to the function but the return is still NULL, why ?.
|
|
|
|
|
CHAIGNEAU wrote:
What do you mean by "characteristics" ?
Characteristics aka properties aka attributes. For example, the class and caption of a window are part of its characteristics.
CHAIGNEAU wrote:
I've got the class name of a button...
Which is what?
CHAIGNEAU wrote:
...but the return is still NULL, why ?.
What does GetLastError() return?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Here is an eample :
HWND handle;
CWnd * pWnd = GetDlgItem(PB_REDRAW);
CString cs_Temp;
GetClassName(pWnd->m_hWnd,(LPTSTR)((LPCSTR)cs_Temp),100);
handle = FindWindowEx(m_hWnd,NULL,cs_Temp/*"Button"*/,"");
int err = ::GetLastError();
while (handle)
{
handle = FindWindowEx(m_hWnd,handle,cs_Temp,"");
}
this code is in the Oninitdialog and it works for edit, combo ... but not for buttons.
|
|
|
|
|
OnInitDialog()
{
CButton* pChild = GetWindow(GW_CHILD);
while(::IsWindow(pChild->m_hWnd)){
CString csClassName;
::GetClassName(pChild->GetSafeHwnd(), &csClassName, 6);
if(csClassName=="BUTTON"){
}
pChild = GetWindow(GW_HWNDNEXT);
}
}
This is what I had in mind
I'm drinking triples, seeing double and acting single
|
|
|
|
|
CHAIGNEAU wrote:
GetClassName(pWnd->m_hWnd,(LPTSTR)((LPCSTR)cs_Temp),100);
This is wrong, and is why I asked for a code snippet in my initial reply. The correct implementation should be:
GetClassName(pWnd->m_hWnd, cs_Temp.GetBuffer(100), 100);
cs_temp.ReleaseBuffer();
You should also set a breakpoint on the FindWindowEx() call and verify that cs_temp is "Button" before continuing.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I am trying to make an app which will act like the standard toolbar in Windows (i.e. always present, dockable)from the main window (i.e. not attached to a doc window) with application buttons. What is the best approach, use wizard and create dialog? Which class would be best to inherit from CDialog, CDialogBar, or CToolbar? Are there any examples out there which might help?
Thanks for the advice..
|
|
|
|
|
Is there anyone that has successfully used the mysql embedded server functionality? If so I would be very happy if you could supply some example code and/or point out known problems, quirks etc.
|
|
|
|
|
Have you looked at the examples supplied by MySQL
I'm drinking triples, seeing double and acting single
|
|
|
|
|
Yes, I tried the samples and have no got them working. Still I got strange errors when debugging. The examples crash on mysql_server_end. Any clues?
|
|
|
|