|
Hello,
I need to parse a data file which contains reals.
The decimal separator use is always the dot '.'
I try to extract the values using a stringstream to get the result into a double.
As you probably know, stringstream use the current locale to determine the decimal seperator to use...
and that is my problem !
How can I tell to my stringstream to use the dot separator regardless the current locale ?
I can not find a "simple" snippet to do this.
Any idea ?
|
|
|
|
|
jeremie.delaitre wrote: Any idea ?
I don't know the specific answer. Based on my limited knowledge of STL I would think you could create a specific locale and make the stream use it. I think streams have like imbue() function or something to make them use specific locales.
led mike
|
|
|
|
|
Yes there is an imbue method and I can, in theroy, create my own.
Indeed, the documentation I have on it is vague so I wonder if a simpler solution exists.
|
|
|
|
|
jeremie.delaitre wrote: so I wonder if a simpler solution exists.
Depends on your definition of simpler. You could certainly parse the data yourself, perhaps using Regular Expressions.
led mike
|
|
|
|
|
Dear All,
My requirement is to change the bitmap of the button on mouse move and mouse over. I have used TrackMouse event to do this. But I have problem in this, that is, when I place a mouse over the button the bitmap is changed and again when I take mouse over the button the bitmap is again changed. This looks bad due to painting and re-painting continously. Please advice me a good way. The code is below :
void Test::OnMouseMove(UINT nFlags, CPoint point)
{
TRACKMOUSEEVENT trackmouseevent;
if(!click2)
{
trackmouseevent.cbSize = sizeof(trackmouseevent);
trackmouseevent.dwFlags = TME_LEAVE;
trackmouseevent.hwndTrack = GetSafeHwnd();
trackmouseevent.dwHoverTime = HOVER_DEFAULT;
_TrackMouseEvent(&trackmouseevent);
}
GetDlgItem (IDC_BUTTON3)->GetWindowRect (&rect);
ScreenToClient (&rect);
if ((!rect.PtInRect(point)))
{
bool val=but2.LoadBitmaps(IDB_BITMAP23,0,IDB_BITMAP23,0);
but2.Invalidate();
but2.UpdateWindow();
}
GetDlgItem (IDC_BUTTON2)->GetWindowRect (&rect);
ScreenToClient (&rect);
if ((!rect.PtInRect(point)))
{
bool val=input.LoadBitmaps(IDB_BITMAP22,0,IDB_BITMAP22,0);
input.Invalidate();
input.UpdateWindow();
}
CDialog::OnMouseMove(nFlags, point);
}
LONG Test::OnMouseLeave(WPARAM , LPARAM)
{
POINT point;
GetCursorPos(&point);
ScreenToClient(&point);
CRect rect;
GetDlgItem (IDC_BUTTON2)->GetWindowRect (&rect);
ScreenToClient (&rect);
if (rect.PtInRect(point))
{
bool val=input.LoadBitmaps(IDB_BITMAP57,0,IDB_BITMAP57,0);
input.Invalidate();
input.UpdateWindow();
click2=false;
}
GetDlgItem (IDC_BUTTON3)->GetWindowRect (&rect);
ScreenToClient (&rect);
if (rect.PtInRect(point))
{
bool val=but2.LoadBitmaps(IDB_BITMAP58,0,IDB_BITMAP58,0);
but2.Invalidate();
but2.UpdateWindow();
click2=false;
}
|
|
|
|
|
Unless I'm mistaken, you're reloading the button's bitmap each and every time the mouse sends a move event. Why don't you only draw the bitmap when it changes?
You could either keep a track of the mouse position last move, and compare the last pos to the current pos, to see if the mouseOver status has changed for either button.
Or, you simply could add some flags to hold the current mouseOver status of each button. Comparing the current status with the last to determine if the bitmap needs to be changed to reflect the mouse position.
|
|
|
|
|
Hi
I am creating plugin for VS2005 in which i want to handle the Click event of Window->New Vertical Tab. i.e. Whenever user click on plugin icon, "New Vertical Tab's events should call. So Is there any API for handling above events.
Regards
aaa
|
|
|
|
|
HI,
in CString Find Function can i use variable insted of fixed text.
Just for example .
CString str = _T("ABCD edbd CDE ~");
int nPosition = str.Find("~",0);
instead of passing " ~ " can i use any varible ?
Just like this CString EndDelimeter = _T("~");
int nPosition = str.Find(EndDelimeter ,0);
Because user can change any special charecter as End delimeter.
Plz advice me
Preethi
|
|
|
|
|
Hi,prithi
U can use Replace() function of CString Class.
|
|
|
|
|
hi Atul,
I dont want to Replace The string , I just want to find the Special character position.
|
|
|
|
|
Yes, you can use any text variable with the CString::Find() method. Are you not able to do something? What do you need advice with?
|
|
|
|
|
Thank u , Iam able to do that now. while i run first time i got errors. Sorry to disturb u .
|
|
|
|
|
I am creating object for CStatic, but I am not able to set the Text for that CStatic control through another function of ButtonClicked.
I am getting an error as :
Unhandled exception at 0x7c2399ba (mfc71d.dll) in hit.exe: 0xC0000005: Access violation reading location 0x000042ba.
In short I am getting Access violation error.
Please reply.
|
|
|
|
|
Member 4370385 wrote: I am creating object for CStatic
How did you do that ?
|
|
|
|
|
Member 4370385 wrote: ...but I am not able to set the Text for that CStatic control...
How are you doing this?
Member 4370385 wrote: In short I am getting Access violation error.
Have you used the debugger to step through the code to find out where the access violation is happening?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Member 4370385 wrote: Please reply.
Done.
BTW no code => no help.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi ,
Current we have #import "msxml.dll" named_guids raw_interfaces_only. This was working in Windows-2003. Now our current OS is Vista. We are getting a compilation error like Cannot open type library file: 'msxml.dll': No such file or directory. I know that msxml.dll is deprecated in vista. But what could be the alternative . I tried replaceing msxml3 in above statement but I getting error C2653: 'MSXML' : is not a class or namespace name
|
|
|
|
|
Possibly msxml3.dll doesn't define such a namespace. And you have to adapt your code to use the MSXML2 one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi All,
I am trying to use the Date Time picker with the CDateTimeCtrl but seem to be having some difficulties.
I have added a Date Time Picker to my dialog box, used the microsoft ClassWizard to add a CDateTimeCtrl for the Date Time Picker but nothing seems to work correctly.
I have copied the code below.
I am getting the correct time information in 'Release' mode, but the same is crashing (Debug assertion failure)
in 'Debug' mode.
Pls tell me how to make this code works in 'Debug' mode ???
CDateTimeCtrl m_StartTimeCtrl;
BOOL CLicenseGeneratorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CTime time = CTime::GetCurrentTime();
m_StartTimeCtrl.SetTime(&time);
}
void CLicenseGeneratorDlg::OnOK()
{
UpdateData(true);
CTime time1;
if (GDT_VALID == m_StartTimeCtrl.GetTime(time1))
{
CString strDate = time1.Format("%d.%m.%Y");
MessageBox(strDate);
}
}
Regards,
Sanjeeva K Kanakam.
|
|
|
|
|
How did you create the date/time control ?
|
|
|
|
|
I placed the DateTimeCtrl on the dialog box.
|
|
|
|
|
Sanjay K wrote: ...the same is crashing (Debug assertion failure)
in 'Debug' mode.
When does this "crash" occur? What line of what file is asserting?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
HI all,
How can remove this error?
fatal error C1093: API call 'ImportFile' failed '0x80070003' : ErrorMessage: The system cannot find the path specified.
What can do?
Thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
"_$h@nky_" wrote: What can do?
Provide the correct path, perhaps.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|