The getcwd function will "get the current working directory" which is not always the same as the directory the process executable is residing in. There are many standard API calls that will change the current working directory of your process. In fact... the CreateProcess function itself has the option of starting your process in an arbitrary working directory.
In InitInstance(), member m_pszExeName is your image name. So, use SearchPath() on the result of CString(m_pszExeName) + CString(".exe"). Use the lpFilePart parameter of the call to isolate the path from the file name.
I made a custom CButton::DrawItem() so that I could draw some buttons the way I want them. One of the things I'm doing with it, is making the button "pin-able" to the right side of the parent dialog's (cwnd) display rectangle (using it both as a child to a CDialog and another CButton, in different cases). It seems though, that when a window is maximized, then restored, the restore doesn't call CButton::DrawItem(), leaving my button in the middle of nowhere. If I track the messages, it doesn't seem the framework ever asks the CButton object (or the parent dialog for that matter) to redraw when it is restored.
Seems like maximize and restore are treated differently in the framework. Has anyone seen this before or know how to deal with it?
I was trying to have the CButton automatically reposition himself within the DrawItem(), that doesn't work too well though (because of the order that the DrawItem() calls are made in) and because WM_SIZE handles some sizing changes different than others. So it was just easier to reposition the button from within the parent if it needs to move (from OnSize() with SetWindowPos() rather than Invalidate()).
I'm having trouble setting precision for floats using ostringstream.
I want all floats to have one digit after the decimal point (i.e 1.0f and 10.0f to be formated as "1.0" and "10.0"). However the 10 is coming out as "10.".
Is there any way to do it?
This is my code:
Seems to be a fairly common hurdle when dealing with the streams.
Found an answer on stackOverflow, it's a requirement that "fixed" is used before trying to
set the precision. If this is not done, the call to setprecision will specify the _total_ number of digits to be displayed. Occurring after "fixed", it will specify the number of places after the decimal point to display.
In VC6 and VS10 this CRT function call goes to atox.c.
In VC6,this CRT function calls __int64 __cdecl _atoi64 in atox.c.Here,they just accumulate the digits and returning the value.They didnt check any limits for generated value.
But,In VS10 this CRT function calls __int64 __cdecl _tstoi64 in atox.c.Here,they are checking the generated value with Max_VAL (_UI64_MAX - 0xffffffffffffffffui64 ).if the generated value exceeds the maximum value,they are just replacing with _I64_MAX - 9223372036854775807i64.
Due to this some Autotests are failing.
Is any other equivalent to _atoi64 in VS10 or any other suggestions please..
No disrespect but let me see if I have this straight.
You have some old tests that have data that is outside the valid range for __int64.
These tests are now failing because somebody (RTL) is checking for valid data.
You want to go back to accepting invalid data so that the test "pass".
What good are the tests if they allow invalid data to go through?
Why aren't you more concerned about the fact that older versions of your application let invalid data go through without any way of detecting it?
I front with a strange problem : I have a MDI app, and a CMDIChildWnd that create a static split window where I stretch in left side e tree view and in the right side three listviews ... in one of these, I want to reflect a message :