|
Locales are platform dependent. They're the most irritating bit of the C++ standard as they leave the likes of Redmond and the Penguin crowd to make the decisions. And they're usually different.
I'm not surprised that your code is going horribly wrong on another level - using printf %s with a wide character string is a recipe for printing the first character out if I've ever seen one.
Cheers,
Ash
|
|
|
|
|
I have an MFC program using CMFCToolBars. The toolbar settings are getting saved and read from the registry fine. However when I make changes to the toolbar, re-compile and run the program, it doesn't see these new changes unless I go into the registry and delete the HKEY_CURRENT_USER\Software\MyProgram\settings key. What should I be doing to keep this from happening?
Thanks
Ray
|
|
|
|
|
I'm not sure what you mean by 'changes in the toolbar' (is it the layout you mean?), but what likely is happening is that when you make changes in your code, you change only the *default* layout. Your program first initializes the layout as your code specifies (the default layout), and then looks for user-customized layout. Since one is available, it *overrides* the changes you have made to your code.
Again (if this is what I'm thinking it is), your code only sets the initial, default layout. If there is user-customized layout it supersedes it. I think this is how it's supposed to work.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
By changes, I mean say if I add a button to a toolbar it doesn't show up unless I delete these setting in the registry. So where or how do I keep it from loading the customized layout if I make changes to my toolbar?
|
|
|
|
|
What type of toolbar are you using? I mean the name of the class. Standard MFC toolbar, or some customized class?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
It is my class with a base class of CMFCToolBar
|
|
|
|
|
See if CMFCToolBar::LoadState[^] is called. Find it in the MFC sources and put a breakpoint on it. On my computer it's in C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\src\mfc\afxtoolbar.cpp
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I'm coding with VC++2008.
When designing the layout of the controls in the .rc file, we can see their coordinates in the bottomright of the screen.
And now I have a control with (4,30) shown there and another one with (5,156). Then I wanna draw a line between these 2 controls using the coordinates by GDI.
pDC->MoveTo(4,30);
pDC->LineTo(5,156);
But at runtime, the line doesn't correspond to those coordinates. I mean there is a big offset from the expected position.
What's wrong?
Thx in advance.
|
|
|
|
|
Units in the resource editor are in DLU ( Dialog (il)Logical Unit); they are used to handle the large font/small font display settings.
from msdn :
dialog unit
A unit of horizontal or vertical distance within a dialog box. A horizontal DLU is the average width of the current dialog-box font divided by 4. A vertical DLU is the average height of the current dialog-box font divided by
M.
Watched code never compiles.
|
|
|
|
|
|
if you want to draw a line between two controls, the safest way is to get the controls' actual on-screen positions, something like:
CRect r1, r2;
ctrl1.GetWindowRect(&r1);
ScreenToClient(r1);
ctrl2.GetWindowRect(&r2);
ScreenToClient(r2);
dc.MoveTo(r1.right, r1.top);
dc.LineTo(r2.left, r2.top);
|
|
|
|
|
|
I have a xml file which hold the structre of Menu items . I want to create the Menu at runtime by reading the XML file .
Can any body help to know how to do this.
Thaks.
|
|
|
|
|
Use the CreateMenu()[^] and associated functions, using the data from your XML file.
It's time for a new signature.
|
|
|
|
|
Hi all,
i have number of items and subitems in list.
no i want to find the clicked item or subitem on double click of ListCtrl.
and also fetch the text of clicked cell.
please tell me how can i do this.
thanks in advance.
|
|
|
|
|
I'm not sure which control you are using but most of the information you need should be here[^].
It's time for a new signature.
|
|
|
|
|
Le@rner wrote: no i want to find the clicked item or subitem on double click of ListCtrl.
Are you referring to this notification?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
|
How about you stick with your original thread here[^]? Go back there and use the "improve question" link to tell us what you've tried and what "not working" means.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
|
Just used the incredible tool Google, and found this[^]. It does pretty much what I understood you need. Implementation uses boost components for thread locking.
Edit: It has a few limitations, as not being able to use a timeout when waiting for elements, but since the source code is provided you can easily add such functionality if desired. If you don't fancy boost, you can replace it with a critical section or equivalent.
|
|
|
|
|
Personally, it'd be like the following:
char str[3];
CFile file;
....
while( !EOF() )
{
file.Read( &str, 3 );
}
file.Close();
But IDK how to write the codes for "!EOF()".
Or any other ways to read files continuously?
Thx in advance!
PS: .txt files
|
|
|
|
|
What do you mean exactly by "continuously" ?
Do you mean you want to read the complete file ?
|
|
|
|
|
yep!
In fact I wanna plot a range of x- and y-coordinates onto a graph while reading them in a txt file.
So I used "continuously".
|
|
|
|
|
The Read function returns the number of bytes read. When there's nothing more to read (because you reached the end of the file), the function will return 0.
|
|
|
|