|
Figure out how to get the data. OnKillfocusFwdLtInsideTire() I know tells me the User has clicked somewhere else. I simply don't know where to collect the data at.
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_FWD_LT_INSIDE_TIRE );
CString str = "";
pEdit->GetWindowText(str);// get the data
Where do I put the above code to get the data?
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: Where do I put the above code to get the data?
In OnKillfocusFwdLtInsideTire() , if that is the point at which you want the data.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Okay, I'll try it there. Question: If the User enters the data then selects [Next] or [Back] on the property sheet does the OnKillfocusFwdLtInsideTire() function still get called before the page becomes inactive?
Also Must you always have to have an ON_EN_SETFOCUS and an ON_EN_KILLFOCUS or can you just have an ON_EN_KILLFOCUS function.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: If the User enters the data then selects [Next] or [Back] on the property sheet does the OnKillfocusFwdLtInsideTire() function still get called before the page becomes inactive?
The best way to find the answer to this is just to try it and see. Set a breakpoint in the handler for EN_KILLFOCUS and PSN_KILLACTIVE to see which is called first.
Larry Mills Sr wrote: Also Must you always have to have an ON_EN_SETFOCUS and an ON_EN_KILLFOCUS or can you just have an ON_EN_KILLFOCUS function.
That depends on what you want to be notified of. If you only have a handler for the ON_EN_KILLFOCUS message, you will not know when the associated control gains focus.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thank you very much for all of your help. I tried the code and it works great in the ON_EN_KILLFOCUS function. I've been trying to solve this problem for 3 weeks.
Thanks again for your help.
A C++ programming language novice, but striving to learn
|
|
|
|
|
|
Looks Great Mark,
What's it supposed to do?
Bram van Kampen
|
|
|
|
|
Maybe you didn't read the post...
It does everything I want it to do...that changes several times a day.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
She sure is Sexxy
---
Yours Truly, The One and Only!
web: devmentor.org
Design, Code, Test, Debug
|
|
|
|
|
Hello,
I have a class which i created, it calculates some mathematical functions, Can i use or create "_beginthread" in the class?
i tried to do it, but i got this error:
error C2664: '_beginthread' : cannot convert parameter 1 from 'void (void *)' to 'void (__cdecl *)(void *)'
class CMaClasse<br />
{<br />
public:<br />
void FoncAppnt(void* args);<br />
void FoncApp(void* arg);<br />
};<br />
<br />
void CMaClasse::FoncAppnt(void* args)<br />
{<br />
_beginthread(FoncApp,0,(void*)a); <br />
}<br />
<br />
<br />
void CMaClasse::FoncApp(void* arg)<br />
{<br />
}
-- modified at 18:18 Friday 9th November, 2007
|
|
|
|
|
Gofur Halmurat wrote: Can i use or create "_beginthread" in the class?
Sure. But, if your thread proc is a class method, that method needs to be static...
class CMaClasse<br />
{<br />
public:<br />
void FoncAppnt(void* args);<br />
static void FoncApp(void* arg);<br />
};<br />
<br />
void CMaClasse::FoncAppnt(void* args)<br />
{<br />
_beginthread(& CMaClasse::
FoncApp,0,(void*)a); <br />
}<br />
<br />
<br />
void CMaClasse::FoncApp(void* arg)<br />
{<br />
}
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Can I use public variable in static function?
because i have some public variables in the class
|
|
|
|
|
A static method can only access static class members.
To get around this, typically a pointer to an object of the class is passed
to the thread proc. Then the thread proc can use that pointer to access
non static members of the class.
Here's an example (my changes are in red)...
class CMaClasse
{
<font color="Red">void *pThreadArgs;</font>
public:
void FoncAppnt(void* args);
static void FoncApp(void* arg);
};
void CMaClasse::FoncAppnt(void* args)
{
<font color="Red">pThreadArgs = args;</font>
_beginthread(&CMaClasse::FoncApp,0,<font color="Red">this</font>);
}
void CMaClasse::FoncApp(void* arg)
{
<font color="Red">
CMaClasse *pThis = (CMaClasse *)arg;
pThis->pThreadArgs->...</font>
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanks Mark,
It helped me alot!!!
|
|
|
|
|
|
Just to explain this behavior see: http://www.parashift.com/c++-faq-lite/pointers-to-members.html.
Briefly, the type of pointer-to-member-function is different from pointer-to-function .There is not cast (new in VC++2005).
|
|
|
|
|
george.dumitru wrote: There is not cast (new in VC++2005).
I never heard of "not cast"!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
There is no cast to non-member function pointer.
|
|
|
|
|
Hi All,
I'm sure that someone has had this problem before. I only wanted to reorganize the constants a little bit when I decided to compile again and boom! ... the famous RC2135 while compiling resources. I installed SP1 but it's still there. I can't compile my project anymore.
I really appreciate any help.
Thanks.
rotter
|
|
|
|
|
I have an input box that a user can enter in 4 characters like 1.34. I need to check if there is a decimal in the input string and truncate everything after the tenth place. Is there a C/C++ function that I can use for this? Thanks
|
|
|
|
|
will CString :: Find help you?
|
|
|
|
|
Using "Add memmer variable wizard", add a variable (Category=value) and set ‘Max chars’ to n.
Or, DDV_MaxChars(pDX, yourVar, 10);
-- modified at 3:50 Saturday 10th November, 2007
|
|
|
|
|
george.dumitru wrote: sing "Add memmer variable wizard", add a variable (Category=value) and set ‘Max chars’ to n.
How does that find the "decimal in the input string and truncate everything after the tenth place"???
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
kani98 wrote: I need to check if there is a decimal in the input string...Is there a C/C++ function that I can use for this?
Check out strchr() , or string::find(), or CString::Find() .
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Is there a C/C++ funciton that will remove a character from a string? I want to remove the decimal from the input string. If someone enter 1.23, I want to use only 1.2, remove the decimal making it 12.
|
|
|
|