|
wow, error in error statement, Hint in Hint statement.
May be this was because the brain-integrated Spell checker cannot spawn when the heavily loaded integrated compiler.
|
|
|
|
|
Actually the brain-integrated Spell checker is Express Edition .
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.
[my articles]
|
|
|
|
|
is this useful,
CString szString( "MyString" );
int istrlen= (szString.GetLength() + 1);
LPTSTR lpsz = new TCHAR[ istrlen];
_tcscpy_s(lpsz, istrlen, szString);
|
|
|
|
|
i tried like ur method . but i did not get perfect o/p.
can u tell more
Franics K Antony
|
|
|
|
|
Can you tell what u exactly need, what is the issue u r facing now
|
|
|
|
|
i am using encryption in the server and cliient . in that i want to encrypt my data in the server and to decrypt in the client side .
to encrypt the data want to convert CSTRING into TCHAR ...
Franics K Antony
|
|
|
|
|
Man, u want to encrypt data i agree, but why u r encrypting the question?
What is the issue, can u post the code snippet.
|
|
|
|
|
CString has a operator LPCTSTR meaning that the convertion to a const TCHAR* is automatic. You probably meant converting to an array of TCHAR, not a TCHAR, right ?
|
|
|
|
|
Hello everyone,
I think compiler is too strict in this case. You can see, no data member, no virtual function.
I am using Visual Studio 2008. The compiler error is simply because of Diamond pattern -- duplicate base class? Actually from logical point of view, there should be no ambiguity issue.
Any ideas?
class Base {
public:
int foo() {cout << "Base" << endl;}
};
class Derived1: public Base
{
public:
int foo() {cout << "Derived1" << endl;}
};
class Derived2: public Base
{
public:
int foo() {cout << "Derived2" << endl;}
};
class Final: public Derived1, public Derived2 {
public:
int foo() {cout << "Final" << endl;}
};
int main()
{
Final f;
Final* p = &f;
Base* pb = p;
return 0;
}
thanks in advance,
George
|
|
|
|
|
modify like this,
Final f;
Derived1* p = &f;
Base* pb = p;
this doesnot give error because compiler knows which compartment to return ie; Base of Derived1
In your case compiler cannot say which one you want Base of Derived1, Base of Derived2. Why do you say logically there is no ambiguity?
|
|
|
|
|
Hi,
I have added a string table to my DLL and added some strings to it.
Now, I am trying to access those strings using Loadstring. But string is not getting loaded. I tried to see the error using GetLastError(). It shows the following error message. "error 1814: The specified resource name cannot be found in the image file".
I am not getting where I am going wrong.
Anyone know about it? Thanks in advance.
|
|
|
|
|
Have u passed the appropriate Module handle to the LoadString API.
|
|
|
|
|
I have done it the following way.
CString strLoad;
bool b = strLoad.LoadString(GetModuleHandle(NULL), IDS_STRING18005, 1033);
|
|
|
|
|
Your dll won't be executing without an EXE(or any such mean), if you put GetModuleHandle(NULL) it returns the module that created the process (mostly the exe that loaded the dll), pass the path to dll or dll handle stored when the dll is loaded.
|
|
|
|
|
Yes, it has worked.
Thanks for the inputs. Thank you very much.
|
|
|
|
|
HI,
i cannot copy CString value to char.but it show error.I typecast the CString value ,but still i get errors.
Pls help me out.
char cAlarmStatus;
CString AlCond;
if(...)
AlCond = "HH";
else
AlCond = "LL";
strcpy(objAlarmData->cAlarmStatus,(LPCTSTR)AlCond);
I get error that cannot convert parameter one form char to char*.
Pls help me how to copy this CString AlCond to cAlarmStatus
Anu
|
|
|
|
|
char T[100] = {0};
CString S = "Hello";
strcpy(T, S.GetString());
Maxwell Chen
|
|
|
|
|
To add with Maxwell's answer,
In your code you used 'char' and not 'char*'..
Try using as Maxwell said or you can allocate memory at runtime with the lenght of CString object and copy the string (but don't forget to release/delete the memory allocated)
Do your Duty and Don't expect the Result
|
|
|
|
|
What do you really need?
I mean, you cannot usually copy the whole CString content to a char variable (it can hold a single character), you need a character array or a pointer to dynamic allocated memory.
On the other hand, you probably don't need at a CString object:
const char * pszAlarmStatus;
if(...)
pszAlarmStatus = "HH";
else
pszAlarmStatus = "LL";
that's all.
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.
[my articles]
|
|
|
|
|
dear all
how to get index of minimum of one array? the following is my code...but however the outcome is wrong after compiled...actually the error is corrNum.
fitness[10] is an 10 elements array,first i would like to calculate minimum value of fitness, and then i need to use its index of this minimum value of array,but result is wrong.anyone can help me? thanks a lot.
for (int i=0;i<10;i++)
{
double minValue = fitness[9];
if (fitness[i] <= minValue)
{
minValue = fitness[i];
for (int j=0;j<150;j++)
{
value = h[i][j] - irisIndNew[j];
if (value == 0)
corrNum = corrNum + 1;
}
}
}
Li Zhiyuan
|
|
|
|
|
Try moving the line "double minValue = fitness[9];" outside of the for (int i...) loop. It's getting assigned to fitness[9] every time through the loop.
double minValue = fitness[9];
for (int i=0;i<10;i++)
{
if (fitness[i] <= minValue)
{
minValue = fitness[i];
for (int j=0;j<150;j++)
{
value = h[i][j] - irisIndNew[j];
if (value == 0)
corrNum = corrNum + 1;
}
}
}
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
thanks friend.
could you help me to check the following code? why i couldn't assign value of p[gbest_Ind][][] to gbest1[gbest_Ind][][], thanks a lot
minValue = fitness[0];
for (int count = 0;count<10;count++)
{
if (fitness[count] < minValue )
{
minValue = fitness[count];
gbest_Ind = count;
}
}
for (int j = 0; j<3; j++)
for (int k = 0; k<4; k++)
{
gbest1[gbest_Ind][j][k]=p[gbest_Ind][j][k];
}
Li Zhiyuan
|
|
|
|
|
#include <algorithm><br />
<br />
using namespace std;<br />
<br />
int main()<br />
{<br />
double myArray[10] = {2.12,432.12,543.1,0.32,0.65,12.,54.2,542.5,100,200};<br />
<br />
double* start = myArray;<br />
double* minimumPosition = min_element(myArray, myArray + 10);<br />
<br />
double minValue = *minimumPosition;<br />
int indexOfMinimum = minimumPosition - start;<br />
return 0;<br />
}
|
|
|
|
|
I have a graph plotted on a picture control. Now I want to click the mouse on top of the graph (CDC * GraphRegion) and get the coordinate of the picture control of the clicked point. How can I do it?
|
|
|
|
|
Handle the OnLButtonDown of the picture control. It will pass you the coordinates of the mouse when it was clicked in a CPoint object. The point will be in client coordinates of the picture control.
- S
50 cups of coffee and you know it's on!
|
|
|
|