|
I am using Standard SDK 500 and EVC++ to develop my UI application.
I have added an edit box to input barcode in my main dialog window.
I want to show soft input panel on my dialog when my cursor hovers over the edit box
to input barcode .
How do I do that?
Ema
|
|
|
|
|
I have a class as...
class Log
{public:
Log(string);
void InitializeLog(string);
...
class Initialize
{ public:
Initialize(string);
void ReadPropfile(string);
....
};
};<pre>
next I am doin this...
<pre>void Log::InitializeLog(string p_path_name)
{
Initialize obj(p_path_name);
obj.ReadPropfile(p_path_name);
}
void Log::Initialize::ReadPropfile(string log_path)
{....}
From the main I call...
Log obj(path);
obj.InitializeLog(path);
...
When I compile I get the following error. How do I get rid of this
test_utility.obj :error LNK2001: unresolved external symbol "public: __thiscall Log::Log(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >)" (??0Log@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@
@std@@@Z)
properties.obj : error LNK2001: unresolved external symbol "public: __thiscall Log::Initialize::Initialize(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >)" (??0Initialize@Log@@QAE@V?$basic_string@DU?$char_tra
its@D@std@@V?$allocator@D@2@@std@@@Z)
THANKS
|
|
|
|
|
pl_kode wrote: class Log
{public:
Log(string);
forget to implement constructor for Log? Log::Log(string) ?
pl_kode wrote: class Initialize
{ public:
Initialize(string);
And Initialize::Initialize(string) too?
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi,
how can I get data from edit control in a integer?
|
|
|
|
|
You can use GetDlgItemInt(IDC_EDIT1) function.
Regards,
Sandip.
|
|
|
|
|
Actually this is double value
|
|
|
|
|
What does that mean?
|
|
|
|
|
Then as toxcct said
You take entire string using GetDlgItemText()
and use atof(),... functions depending on your value type whatever you wanna use.
or
Using Class wizard add the data member variable for that control with appropriate data type.
and call UpdateData().
Regards,
Sandip.
|
|
|
|
|
Use atof() for converting string to double.
CString csValue;
GetDlgItem(IDC_EDIT1)->GetWindowText( csValue );
double dValue = atof( csValue );
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Jijo raj wrote: CString csValue;GetDlgItem(IDC_EDIT1)->GetWindowText( csValue );double dValue = atof( csValue );
The above code gives me error :
error C2440: 'type cast' : cannot convert from 'class CString' to 'char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
in eVc++4.
How do I solve this error.
Thanks
Terry
|
|
|
|
|
Try this.
double dValue = atof((LPCTSTR)csValue );
The previous code snippet compiles perfectly in Visual Studio 6.0. Might be you got the error because of eVc++4.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Jijo raj wrote: double dValue = atof((LPCTSTR)csValue );
Redundant cast.
"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
|
|
|
|
|
On trying you code you provided, I get :
Jijo raj wrote: double dValue = atof((LPCTSTR)csValue );
: error C2664: 'atoi' : cannot convert parameter 1 from 'const unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
I am working with eVC++4 on WinCE MFC application. Hope to find some alternative to the problem.
Thanks
Terry
|
|
|
|
|
Jijo, got it working as :
<pre>
CString csValue;
GetDlgItem(IDC_OpNo_EDIT)->GetWindowText( csValue );
int no = atoi((char*)(LPCTSTR)csValue);
</pre>
And guess what, on appling to 1 UpdateData, 1 Assertion Failure is gone. Still other are their. Thinking to apply the same technique wherever using UpdateData & get rid of the errors & get working done.
For building an application for Win CE device that supports Embedded VC++ & .NET 2003. Is developing in 2003 VC++ much easier than working with eVc++? Asking as I am getting such errors & problems with eVC. Will the same or similar arise with 2003 VC also?
Thanks for all your efforts.
Thanks
Terry
|
|
|
|
|
The error has to do with your Unicode settings. You can use _stscanf() which will work with both MBCS and Unicode.
"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
|
|
|
|
|
You can convert from CString to char* in two steps:
CString str1;
char* str2;
...
str2 = (char *) (const char *) str1;
If I have to do this a lot, I define:
#define STOC(X) ((char *) (const char *) (X))
Where STOC stands for "String to char*".
|
|
|
|
|
OOps Alan,
CString csValue;
GetDlgItem(IDC_OpNo_EDIT)->GetWindowText( csValue );
char* str2;
str2 = (char*) (const char*)csValue;
char* stopString;
long l = strtol(str2, &stopString, 9);
int i = (int)l;
: error C2440: 'type cast' : cannot convert from 'class CString' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.
Can't understand what is the solution for a simple task.
_stscanf() provided by a helpful member is also not supported by eVC++ in CE platform.
The main reason for doing this conversion is the application throws "Assertion Failure" message followed by "An unsupported operation was attempted" on UpdateData. Their is no scope to debug or find the actual error line. On commenting UpdataData, the error/message doesn't come. So am loking some way to do casting by getting the text via GetWindowText() which by default returns CString only.
I appreciate everybody's help, but still need help to get rid of error messages & make it working one way or the other. Hope to get help.
Thanks
Terry
|
|
|
|
|
You probably have UNICODE defined, so substitute wchar_t for char in the example and it will work perfectly.
|
|
|
|
|
UNICODE is not in the picture at all.
Got it working as expected. None of the above worked. The correct solution found is :
CString csValue;
GetDlgItem(IDC_OpNo_EDIT)->GetWindowText( csValue );
int no = atoi((char*)(LPCTSTR)csValue);
Thanks to all of you for all of your support & efforts.
Thanks
Terry
|
|
|
|
|
|
several ways.
either you get the full content as a string, then you cast it to an integer youself, or you can also map an integer variable to your edit control.
|
|
|
|
|
See GetDlgItemInt()[^] and GetWindowText()[^]
Or use a member variable and call UpdateData(true) (The last thing you should be doing, if you know what it does).
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Attach int variable with edit control with the help of class Wizard.
-@SuDhIrKuMaR@-
|
|
|
|
|
You can also attach double variable for DDX.
-@SuDhIrKuMaR@-
|
|
|
|
|
If you are not filtering the allowable characters in the edit control, you may have cases where users enter data that cannot be converted to a double. For example, 12345.65a , abc123 , 123..4 , etc.
While I would suggest getting the text from the control and then converting it to a double, I would use strtod(...) /_tcstod(...) /wcstod(...) instead. It provides a way to tell you what character causes conversion to fail, which can be used to provide automatic error handling (i.e. ignore any invalid characters), or to provide a more helpful error message to the user.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|