|
Mark Salsbery wrote: Hey what happened to CPhog?
I'm using it to post this?
Damn! Missed the opportunity to say "It works on my machine!"
Last modified: 12mins after originally posted --
led mike
|
|
|
|
|
hehe see my modified post
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You need to CFile class and CString then you can use of SetWindowText for show values on the editbox.
|
|
|
|
|
Hamid. wrote: you can use of SetWindowText for show values on the editbox
Don't you like the idea of having a member variable? Do you really need SetWindowText to set text of an edit box in MFC?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Yeah I agree with you.
|
|
|
|
|
Rajesh R Subramanian wrote: Don't you like the idea of having a member variable?
Sure, as long as it's a CEdit variable.
Rajesh R Subramanian wrote: Do you really need SetWindowText to set text of an edit box in MFC?
No, but the other alternative can, and often does, cause problems that are easily avoidable.
"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
|
|
|
|
|
DavidCrow wrote: Sure, as long as it's a CEdit variable.
I meant that, of course.
DavidCrow wrote: No, but the other alternative can, and often does, cause problems that are easily avoidable.
But there are circumstances when it comes very handy. And as I kept doing it, I learned my way to do it correctly. I'd agree that it may create problems though.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hello everyone,
In the Bjarne's book, there is a line of code like this,
typedef typename A::template rebind <Link>::other Link_alloc;
It means if A is allocator, we can use use to allocate arbitrary type of object instance, said by Bjarne.
I understand this statement, my question is about the grammar. Do we need the template keyword? Why?
I have tested without temlpate keyword, the code still works. Any ideas?
template <class T1> class Foo {
public:
template <class T2> class Goo {
public:
typedef T2 GooValueType;
};
};
int main()
{
Foo <int>::Goo<char>::GooValueType a1;
Foo <int>::template Goo<char>::GooValueType a2;
return 0;
}
thanks in advance,
George
|
|
|
|
|
George_George wrote: In the Bjarne's book, there is a line of code like this,
typedef typename A::template rebind ::other Link_alloc;
Whats the context? or the page number?
|
|
|
|
|
Section 19.4.1 The Standard Allocator. Any ideas?
regards,
George
|
|
|
|
|
I want to add my application in windows firewall exception list on Windows Vista.
Amar
|
|
|
|
|
|
dear all
how to do the following code, i spent much time, however i couldn't complete it, thanks a lot.
for (int iY=0,iX=0;iY<iheight,ix><iwidth;iy++,ix+ mode="hold"> {
if (iY==0)
ucImgdata[iX]=ucImgdata[iX]*mask[1]+ucImgdata[iX+1]*mask[2];
else if (iY==iHeight-1)
ucImgdata[iX]=ucImgdata[iX]*mask[0]+ucImgdata[iX+1]*mask[1];
else
ucImgdata[iX]=ucImgdata[iX]*mask[0]+ucImgdata[iX+1]*mask[1]+ucImgdata[iX+2]*mask[2];
}
ucImgdata+=iBuffwidth;
actually my goal is i have two arrays, one is 1x3, the other is iWidth x iHeight,first i want to multiply every point of iWidth x iHeight by center point of 1x3, when first point or last point of 1x3 array is out of iWidth x iHeight, just don't evaluate.that means i multiply each point of iWidth x iHeight by center point of 1x3 from beginning to end. however i tried to do this, but couldn't, the code above is no problem when i compiled, but when i processed the image via invoking this function, it aborted, thanks a lot
Li Zhiyuan
|
|
|
|
|
Hi,
if i get what you're saying, you are trying to a convolution on the image. You have a convolution kernel of [3x1] ( width is 3, height is 1) and an image of [height x width].
I'll assume your image is an 8-bit per pixel image (Grayscale).
You can achieve convolution by;
<br />
unsigned char kernel[3] = {1,3,1};
unsigned char *pImage = XXX;
<br />
for(int y = 0; y < height; y++)<br />
for(int x = 1; x < width-1; x++)
{<br />
pImage[x+y*width] = pImage[(x-1)+y*width]*kernel[0] + pImage[x+y*width]*kernel[1] + pImage[(x+1)+y*width]*kernel[2];<br />
}<br />
Also note, the result might be bigger than the capacity of unsigned char (in this example), so it is advisable to divide the convolution result by the kernel total size, that is (1+3+1) = 5 in this case. (Not shown above).
If you want to maintain the result without dividing, the output image size must be bigger, like 'int' etc.
Hope this helps.
Before i forget, the kernel i used is [3x1], you can also do [1x3] vertical kernel, just change the x,y operation above.
Cheers
|
|
|
|
|
thanks friend, my kernel is also 3x1, i made a mistake. thanks a lot, first let me try to do, if any problem, hope you can continue helping me.thanks
freind, i need to do twice convolution, first time is 1x3, sencond is 3x1, by i have to multiply each point of image, i read your code, you started from second pixel of image, my boss asked me to start from first pixel. how to carry out twice convolution? first 1x3, and then 3x1, thanks a lot
Li Zhiyuan
modified on Tuesday, March 4, 2008 1:56 AM
|
|
|
|
|
dear friend
how to code using 3x1, i can do using 1x3, now because i used rgb to do this, so i have width*3, how to change rgb three values to one grayscale value? thanks a lot
Li Zhiyuan
modified on Tuesday, March 4, 2008 4:06 AM
|
|
|
|
|
Step through the code using the debugger.
"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
|
|
|
|
|
How do we implement a grid or a graph on a video and what needs to be done to show the value when we point the cursor on a particular location. like the way we see in excel
|
|
|
|
|
Hi guyz,
Is it possible to convert HDC to CDC?
When I pass CDC to other class I use its HDC,
CDC->m_hDC
this is to perform the process in there.
Rather, I need a way to convert HDC to CDC and make some drawing over it.
Now I'm encountering a problem integrating a CDC with the returned HDC.
I needed the HDC as my background and the CDC for the drawing like lines.
If you have an idea please let me know.
Thank you
|
|
|
|
|
Hi man.
I know how to convert it is.
show below
if your handle is m_hDC,
CDC* pCDC = CDC::FromHandle(m_hDC);
Ok. You can get the CDC* from m_hDC
|
|
|
|
|
That will only work if the HDC is already wrapped by a CDC . To wrap a HDC in a CDC use the CDC::Attach method.
Steve
|
|
|
|
|
May be i understood wrongly,
CDC::FromHandle()
"If a CDC object is not attached to the handle, a temporary CDC object is created and attached." from msdn.
|
|
|
|
|
To wrap a HDC in a CDC use the CDC::Attach method. If the HDC is already wrapped by a CDC use the CDC::FromHandle method, as mentioned by the first replier.
Steve
|
|
|
|
|
Stephen Hewitt wrote: To wrap a HDC in a CDC use the CDC::Attach method. If the HDC is already wrapped by a CDC use the CDC::FromHandle method,
If Microsoft ever starts documenting that stuff CodeProject traffic would really decrease.
led mike
|
|
|
|
|
Thank you very much for your replies.
I will try this now.
|
|
|
|