The %s directive makes printf() and friends expect a string pointer on the stack. If you pass an object, such as std::string, you'll give it "garbage". If you give it a pointer to the internal string buffer instead, it'll work.
I agree with David's suggestion. Passing C++ as a "optional" parameter yeilds undefined behaviour. With CStrings, you can do this, and I bet Microsoft engineers did some tweaking to make that work. I don't know about std::string, but chances are that they are not crafted in such a way that they will work with printf()-like functions...
I want to develop an MFC application that has
1. Either a control bar or dialog bar which has some button objects
2. The bar needs to be always accessible. That means I want to be able to click on the buttons on the bar even if a modal dialog showing.
One way I thought of to put the dialog bar in its user thread, but this is almost impossible as it dialog bar needs to send a message to the main windows. Another way was not to show modal dialogs, but this would complicate the design as to manage the number of different dialogs to be displayed.
Any thought as to how to put a controls bar/dialog bar/or even a child windows on its own thread that can always listen to user actions? A pointer to an article or sample code would be great.
The whole UI doesn't need to be alive, but a portion of it needs to be alive all the time. Think it this way, I want my toolbars to be alive all the time.
I started looking into creating my toolbar as a CDialogBar item which will run in it's own CWinThread. I though this will isolate it from the whole UI message loop. Since the CDialogBar object is created inside the CFrameWnd object, whenever the main UI is blocked, so does goes the second CWinThread which has my CDialogBar object.
I could create my CDialogBar as a child of the Desk top, which solves the blocking issue, but it lives outside the main UI frame, which does not meet my requirement.
Any idea as to how I might be able to solve this?
/* I can C */
// or !C
Last Visit: 31-Dec-99 19:00 Last Update: 24-Feb-24 6:41