|
Derive a new class from CSplitterWnd. Lets call it mySplitterWnd. Then make the following changes:
void mySplitterWnd::OnLButtonDown(...)
{
CWnd::OnLButtonDown(...);
}
void mySplitterWnd::OnMouseMove(...)
{
CWnd::OnMouseMove(...);
}
BOOL mySplitterWnd::OnSetCursor(...)
{
return CWnd::OnSetCursor(...);
}
Trust in the code Luke. Yea right!
|
|
|
|
|
Hi,
Can anyone help me with this? i get this error and i can't figure out what is meant by that error C2102: '&' requires l-value.
My piece of code is the following
#include <stdio.h>
#include <math.h>
double tailing = 0;
double trl_values = 0;
double y_int_1 = 0;
int rest = 0;
double leading = 0;
double histogram_ram = 0;
double i_index;
double Trl_values;
double y_int = 0;
/*******************************************************************************************
Transfer function:
1
----------------
3.333e-005 s + 1
Transfer function:
0.1829 z + 0.11829
-----------------------
z - 0.6341
Sampling time: 1.9113e-008
********************************************************************************************/
unsigned char Slice_level(unsigned char x) // Function accessible only from this file
{
double b0=0.1829,b1=0.11829;
double a1= 0.6341;
double temp_x1,temp_x2;
double temp_y1;
unsigned char y;
int static xn_1;
int static yn_1,yn_2; // y(n-1)
temp_x1 = x * b0;
temp_x2 = xn_1* b1;
temp_y1 = yn_1 * a1;
y = temp_x1+ temp_x2 + temp_y1;
xn_1 = x;
yn_1 = y;
return y;
}
//main()
void SLFilter (long amount, unsigned char* pData)
{
long n;
unsigned char y;
for (n=0; n<amount; n++)
="" {
="" y="Slice_level(pData[n]);
" pdata[n]="y;
"
="" printf("%8d="" n",y);
="" }
}
="" *******************************************************************************************
="" this="" code="" shows="" the="" trl_values="" calculation.="" it="" is="" going="" to="" help="" determining="" histogram=""
********************************************************************************************=""
void="" trl_calculation(int="" amount,="" unsigned="" char*pdata)
{
="" long="" n;
="" for="" (int="" i="1;" <="amount;" i++)
="" if="" ((y_int_1)="" -="" 0)="" &="" (y_int=""> 0)
tailing = 1 - (y_int- pData[n])/(y_int - y_int_1);
Trl_values(sizeof(Trl_values)+1) = tailing + leading + rest;
leading = 1 - tailing;
rest = 0;
if ((y_int_1- pData[n] > 0)&(y_int- pData[n] < 0))
tailing = 1 - (y_int - pData[n])/(y_int - y_int_1);
Trl_values(sizeof(Trl_values)+1) = tailing + leading + rest;
leading = 1 - tailing;
rest = 0;
rest = rest + 1;
y_int_1 = y_int;
}
}
void histogram(int amount, unsigned char*pData)
{
const double Duration = amount/4096;
for (int i=1; i <= amount; i++)
{
i_index = ceil(Trl_values(i)/Duration)+1;
histogram_ram(i_index)=histogram_ram(i_index)+1;
}
}
Besides, i also have errors like
error C2064: term does not evaluate to a function
Thx
F.K
|
|
|
|
|
Try using && instead of & (Please indicate in which lines errors are, is not easy to guess it).
~RaGE();
|
|
|
|
|
cpp(48) : warning C4244: '=' : conversion from 'double' to 'unsigned char', possible loss of data
h:\visualc++\trl_calculation\trl.cpp(90) : error C2102: '&' requires l-value
cpp(92) : error C2064: term does not evaluate to a function
cpp(98) : error C2064: term does not evaluate to a function
cpp(116) : error C2064: term does not evaluate to a function
cpp(117) : error C2064: term does not evaluate to a function
cpp(117) : error C2064: term does not evaluate to a function
F.K
|
|
|
|
|
What i was trying to say is : indicate the line of code where you error happens. I still cannot guess which line 92 indicates in the statement :
cpp(92) : error C2064: term does not evaluate to a function
Like :
int bla = 0 // This is throwing an error
so it is possible for us to answer
it's because you've forgotten a ;
So repost your code and indicate which line are bringing up errors.
~RaGE();
|
|
|
|
|
#include <stdio.h>
#include <math.h>
double tailing = 0;
double trl_values = 0;
double y_int_1 = 0;
int rest = 0;
double leading = 0;
double histogram_ram = 0;
double i_index;
double Trl_values;
double y_int = 0;
/*******************************************************************************************
Transfer function:
1
----------------
3.333e-005 s + 1
Transfer function:
0.1829 z + 0.11829
-----------------------
z - 0.6341
Sampling time: 1.9113e-008
********************************************************************************************/
unsigned char Slice_level(unsigned char x) // Function accessible only from this file
{
double b0=0.1829,b1=0.11829;
double a1= 0.6341;
double temp_x1,temp_x2;
double temp_y1;
unsigned char y;
int static xn_1;
int static yn_1,yn_2; // y(n-1)
temp_x1 = x * b0;
temp_x2 = xn_1* b1;
temp_y1 = yn_1 * a1;
y = temp_x1+ temp_x2 + temp_y1; // warning C4244
xn_1 = x;
yn_1 = y;
return y;
}
//main()
void SLFilter (long amount, unsigned char* pData)
{
long n;
unsigned char y;
for (n=0; n<amount; n++)
="" {
="" y="Slice_level(pData[n]);
" pdata[n]="y;
"
="" printf("%8d="" n",y);
="" }
}
="" *******************************************************************************************
="" this="" code="" shows="" the="" trl_values="" calculation.="" it="" is="" going="" to="" help="" determining="" histogram=""
********************************************************************************************=""
void="" trl_calculation(int="" amount,="" unsigned="" char*pdata)
{
="" long="" n;
="" for="" (int="" i="1;" <="amount;" i++)
="" if="" ((y_int_1)="" -="" 0)="" &="" (y_int=""> 0); //error C2102
tailing = 1 - (y_int- pData[n])/(y_int - y_int_1);
Trl_values(sizeof(Trl_values)+1) = tailing + leading + rest; // error C2064
leading = 1 - tailing;
rest = 0;
if ((y_int_1- pData[n] > 0)&(y_int- pData[n] < 0))
tailing = 1 - (y_int - pData[n])/(y_int - y_int_1);
Trl_values(sizeof(Trl_values)+1) = tailing + leading + rest; //error C2064
leading = 1 - tailing;
rest = 0;
rest = rest + 1;
y_int_1 = y_int;
}
}
void histogram(int amount, unsigned char*pData)
{
const double Duration = amount/4096;
for (int i=1; i <= amount; i++)
{
i_index = ceil(Trl_values(i)/Duration)+1; //error C2064
histogram_ram(i_index)=histogram_ram(i_index)+1; //error C2064
}
}
cpp(48) : warning C4244: '=' : conversion from 'double' to 'unsigned char', possible loss of data
cpp(90) : error C2102: '&' requires l-value
cpp(92) : error C2064: term does not evaluate to a function
cpp(98) : error C2064: term does not evaluate to a function
cpp(116) : error C2064: term does not evaluate to a function
cpp(117) : error C2064: term does not evaluate to a function
F.K
|
|
|
|
|
flora_k wrote:
y = temp_x1+ temp_x2 + temp_y1; // warning C4244
Exactly as the warning says: You are pressing the result of adding three double s into an unsigned char (which is the size of a byte ). If you really intend to do that, use y = static_cast< unsigned int >(temp_x1+ temp_x2 + temp_y1);
For the Errors: you probably intended to use the logical AND operator. This is spelled && instead of & .
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
flora_k wrote:
cpp(48) : warning C4244: '=' : conversion from 'double' to 'unsigned char', possible loss of data
explicit : you return an unsigned char, which is a value between 0 and 256, and you want to assign it a sum of doubles, which is a value between -2^63 and 2^63 ... so you may lose some data in the operation.
flora_k wrote:
cpp(90) : error C2102: '&' requires l-value
Your if statement is missing a ). Use && operator instead of & which should only be used to do bitwise operation. Test is done with && or ||.
flora_k wrote:
cpp(92) : error C2064: term does not evaluate to a function
In c++ or c, functions looks like function(parameter) and tables of value like value[] (spot the square brackets). The compiler thinks you are trying to assign the result of the sum to a function call, which does not mean anything at all.
So better try :
histogram_ram[i_index]=histogram_ram[i_index]+1;
you also need to declare the table correctly :
double histogram_ram[SizeOfTable];
Replace SizeOfTable by the size of your table (3 or 255 or ...);
That's the same for the other values. You must be pretty new to c/c++ language ?
~RaGE();
|
|
|
|
|
Thx,for the explanations; i'am new in C programming that's right.
How come one error correction leeds to new errors?
void trl_calculation(int amount, unsigned char*pData)
{
long n;
for (int i=1; i <= amount; i++)
{
if
((y_int_1) - pData[n] < 0) && (y_int - pData[n]) > 0; // error C2143: syntax error : missing ';' before '&&'
tailing = 1 - (y_int- pData[n])/(y_int - y_int_1);
Trl_values(sizeof(Trl_values)+1) = tailing + leading + rest;
leading = 1 - tailing;
rest = 0;
if ((y_int_1- pData[n] > 0)&&(y_int- pData[n] < 0))
tailing = 1 - (y_int - pData[n])/(y_int - y_int_1);
Trl_values(sizeof(Trl_values)+1) = tailing + leading + rest;
leading = 1 - tailing;
rest = 0;
rest = rest + 1;
y_int_1 = y_int;
}
}
void histogram(int amount, unsigned char*pData)
{
double i_index;
const double Duration = amount/4096;
double *histogram_ram[4096];
for (int i=1; i <= amount; i++)
{
i_index = ceil(Trl_values(i)/Duration)+1;
histogram_ram[i_index]=histogram_ram[i_index] +1; //error C2106: '=' : left operand must be l-value
//error C2108: subscript is not of integral type
}
}
F.K
|
|
|
|
|
flora_k wrote:
How come one error correction leeds to new errors?
When the compiler encounters an error, it may or not be able to recover from it to continue compiling the rest of the code. When you fix an error, the compiler can now get past that piece of code and possibly on to code that it was unable to get to before.
I've never seen the VC++ compiler go past 102 errors. That may be a configurable number, but I've never bothered to check.
Your code
if<br />
((y_int_1) - pData[n] < 0) && (y_int - pData[n]) > 0;
is missing a trailing parenthesis. The syntax of an 'if' statement is
if (some condition)
What goes in between the parenthesis can be anything, including any number of left and right parenthesis, as long as they match.
double *histogram_ram[4096];<br />
histogram_ram[i_index]=histogram_ram[i_index] +1;
histogram_ram is an array of pointers. I don't think this is what you intended. Remove the '*' from the declaration.
histogram_ram[i_index]=histogram_ram[i_index] +1; //error C2108: subscript is not of integral type
The type of variable used as an array subscript must be int, short, or char. Using a type that can have a fractional value (e.g., double) makes no sense, hence the error.
|
|
|
|
|
cpp(48) : warning C4244: '=' : conversion from 'double' to 'unsigned char', possible loss of data
h:\visualc++\trl_calculation\trl.cpp(90) : error C2102: '&' requires l-value
cpp(92) : error C2064: term does not evaluate to a function
cpp(98) : error C2064: term does not evaluate to a function
cpp(116) : error C2064: term does not evaluate to a function
cpp(117) : error C2064: term does not evaluate to a function
F.K
|
|
|
|
|
Hi
I made a derived class from CListCtrl.
I tried to use GetItemRect in a paint() function in that class
void CMyListCtrl::OnPaint()
...
CHeaderCtrl* pHC = (CHeaderCtrl*)GetDlgItem(0);
if ( pHC != NULL )
{
CRect rcH;
pHC->GetItemRect(0, &rcH);
}
This should certainly work because GetItemRect() is a member function of CListCtrl. But VC5 doesn't recognise this member function.
I know i can obtain the same thing with manually sending a message
something like:
OnPaint();
...
CHeaderCtrl* pHC = (CHeaderCtrl*)GetDlgItem(0);
if ( pHC != NULL )
{
CRect rcH;
this->SendMessage(LVM_GETITEMRECT, &rcH, 0);
}
LVM_GETITEMRECT is the message 'GetItemRect' sends, but this doesn't work. Does anyone know how to do this correctly?
Greetings
Jens
|
|
|
|
|
JensB wrote:
of CListCtrl
You mean of CHeaderCtrl ?
JensB wrote:
VC5 doesn't recognise this member function.
What is the error that you get ? It does not compile ?
~RaGE();
|
|
|
|
|
I used this article:
http://codeguru.earthweb.com/listview/EmptyLV.shtml
Sorry, i meant CHeaderCtrl
if (pHC != NULL)
{
CRect rcH;
pHC->GetItemRect(0, &rcH);
rc.top += rcH.bottom;
}
and the following error i receive:
error C2039: 'GetItemRect' : is not a member of 'CHeaderCtrl'
and yes, it does not compile. The problem is i'm using VC5, VC6 it should compile ok.
But i'm currently working in a VC5 project and can't leave that project because the bought functions which connect to a dbaseIV database won't work on VC6.
Can i manually send a message for getting the getitemrect()?
Greetings
Jens
|
|
|
|
|
Try :
HDM_GETITEMRECT<br />
wParam = (WPARAM) (int) iIndex;<br />
lParam = (LPARAM) lpItemRect;
so something like
pHC->SendMessage(HDM_GETITEMRECT,0,&rcH);
~RaGE();
|
|
|
|
|
CRect rcH;
pHC->SendMessage(HDM_GETITEMRECT,0,&rcH);
//pHC->GetItemRect(0, &rcH);
rc.top += rcH.bottom;
I tried that already before and i have compilation errors:
SendMessageA' : cannot convert parameter 3 from 'class CRect *' to 'long'
|
|
|
|
|
Use a RECT instead of the CRect.
That way :
RECT rcH;
pHC->SendMessage(HDM_GETITEMRECT,(WPARAM)(int)0,(LPARAM)&rcH);
~RaGE();
|
|
|
|
|
ok this works good
Thanks alot
Just Edited
Now only need to find out how i center (vertically + horizontally) the message in the listview. That would be nice.
Greetings
Jens
|
|
|
|
|
JensB wrote:
how i center the message in the listview
What do you mean ? Which message ?
~RaGE();
|
|
|
|
|
I use this article to show a message when the listview is empty:
http://codeguru.earthweb.com/listview/EmptyLV.shtml
Would it be possible to center the message like 'No items in the list.' in the list view.
Like this:
The message 'test' is centered (horizontally & verticaly) within the list view.
- - - - - - -
| |
| test |
| |
-------------
Greetings
Jens
|
|
|
|
|
JensB wrote:
I use this article to show a message when the listview is empty:
http://codeguru.earthweb.com/listview/EmptyLV.shtml
Sorry, i had forgotten that
pDC->DrawText(strText, -1, rc, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_NOPREFIX | DT_NOCLIP);
should do it.
~RaGE();
|
|
|
|
|
hi, on my PC, default language is English. I have selected russian as the second language. I selected ctrl + shift for switching between the languages in keyboard settings. i have a dialog based App in which i placed an edit box. when i run the App, its running and in the edit box iam typing english characters. Then i pressed Ctrl+shift, and pressed some keys. It was not russian letters in edit box, still iam getting english letters. Why is this happening. What should i do to get russian letters as input into edit box. I would be grateful if some one can help me. Thank you in advance.
|
|
|
|
|
The language used in your editbox depends on the language used to compile the project. (This is asked by the application wizard).
Search here on CP about internationalisation.
~RaGE();
|
|
|
|
|
Does anybody know of a good site for information on using templates. I've managed to knock up a template class for storing a variable number of structures (similar to CAtlArray) but I'm wondering if there is a better (more correct) way to do it. I'm basically looking for a kind of do's and don'ts list.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Steve Thresher wrote:
but I'm wondering if there is a better (more correct) way to do it
Using the std::vector class would be portable and standard conform.
If you really must reinvent the wheel, you can always look at their implementation (preferably NOT at the implementation shipped with VC6). Maybe STLPort is better.
My opinions may have changed, but not the fact that I am right.
|
|
|
|