|
try the below code. If everthing goes fine, it will draw a rectangle on the top left portion of the image;
HDC pDC=::GetDC(0);
HDC TmpDC=CreateCompatibleDC(pDC);
CImage _image;
_image.Load(_T("//read.tif"));
int width=_image.GetWidth();
int height=_image.GetHeight();
HGDIOBJ TmpObj2 = SelectObject(TmpDC,(HGDIOBJ)(HBITMAP)_image);
Rectangle(TmpDC, 0,0, width/2, height/2 );
SelectObject(TmpDC,TmpObj2);
ReleaseDC(pDC);
|
|
|
|
|
ReleaseDC(pDC);
Showing Error message naveen like
error C2664: 'CWnd::ReleaseDC' : cannot convert parameter 1 from 'HDC' to 'CDC *'
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
modify
::ReleaseDC(0, pDC);
|
|
|
|
|
its execute completly with out error but its not creating any rectangle in image... naveen ...
HGDIOBJ TmpObj2 = SelectObject(TmpDC,(HGDIOBJ)(HBITMAP)_image);
Rectangle(TmpDC, 0,0, width/2, height/2 );
SelectObject(TmpDC,TmpObj2);
::ReleaseDC(NULL,pDC);
any need to create the new bitmap for this HGDIOBJ TmpObj2 ..??
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
How did u verify that no rectangle is coming..?
|
|
|
|
|
just i save the image like read.tif ..its not show the rectangle so that??
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
hope you saved the image like the code below
_image.Save( _T("c:\\abcd2.bmp"), Gdiplus::ImageFormatBMP );
|
|
|
|
|
thanks naveen ...i never forget this help
i would like say ..please add my name to your friends list please .
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
rajugis wrote: thanks naveen
Your are welcome.
|
|
|
|
|
hi Naveen ..is that any possible for create the rectangle in Color??
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
Yes. check MSDN[^]. It says, "The current pen outlines the rectangle and the current brush fills it. ".
so create the brush of desired color, select it to the DC and then draw
|
|
|
|
|
one small doubt naveen ....
i want to show only the cutting image portion ..but the output image contains only the except cutting image portion.
??
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
What? I didnt understand..
|
|
|
|
|
u assume ...that
one image file contains 5 buildings ..i want to cut and save only the 5th building ,other buildings are not shown in the image.
but when we are save the image 5th building not shown other four buildings are shown in the image...
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
When I'm working with DC's and Bitmaps, and BitBlts, I like to use the following utility from PJ Arends.
Image Viewer Utility[^]
It lets you debug your code, and see the results of image changes like a variable in a watch window.
Very handy, and a shame PJ isn't around CP anymore. (OK, hardly ever)
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
The following code can run correct in VC6.0,but in VC2005 it can not show the text.
Who can tell me why.
//m_pResult is a CEdit pointer
if(!m_pResult->IsWindowVisible())
{
CRect rect;
this->GetClientRect(rect);
m_pResult->MoveWindow(rect);
m_pResult->ShowWindow(SW_SHOW);
m_pResult->SetWindowTextA("aaaa\r\nbbbbb");
}
else
m_pResult->ShowWindow(SW_HIDE);
be my girl , OK?
|
|
|
|
|
liu3p wrote: m_pResult->SetWindowTextA("aaaa\r\nbbbbb");
May be the project is unicode. Use SetWindowText instead of SetWindowTextA
m_pResult->SetWindowText( _T("aaaa\r\nbbbbb"));
|
|
|
|
|
That is correct.
In VC 6.0 all projects are by default non-unicode.
In VS2005 all projects are by default unicode.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Done.Thank you.
be my girl , OK?
|
|
|
|
|
#include<stdio.h>
#define abs(x) ((x<0)?(-(x)):(x))
#define epsilon .000000000001
#define size 5
double multiply(a,m,product)
double a[size][size],product [size][size];
int *m;
{
int test=0;
int count,i,j,k,l;
double olda[size][size],diff;
for(i=0;i<*m;i++)
for(j=0;j(* m;j++)
olda[i][j]=a[i][j];
for(count=1;count<=1000;count++)
{
for(i=0;i<*m;i++)
for(j=0;j<*m;j++)
product[i][j]=0;
for(i=0;i<*m;i++)
for(j=0;j<*m;j++)
for(k=0;k<*m;k++)
product[i][j]=product[i][j]+a[i][k]*olda[k][j];
for(i=0;i<*m;i++)
for(j=0;j<*m;j++)
{
diff=abs(product[i][j]-olda[i][j]);
if(diff>epsilon)
{
test=1;
for(k=0;k<*m;k++)
for(l=0;l<*m;l++)
olda[k][l]=product[k][l];
}
break;
if(test<1)
{
printf("\nThe numberof iterations is:");
printf("\n");
printf("\n %d",count);
break;
}
test=0;
}
return(0);
}
main()
{
static double a[size][size]={{0.1,1.0,0.0,0.0,0.0},
{0.0,0.0,0.3,0.7,0.0},
{0.0,0.0,0.0,0.2,0.8},
{0.0,0.0,0.1,0.0,0.9},
{1.0,0.0,0.0,0.0,0.0}};
double product[size][size],pi[size],diff;
int test;
int m=size;
int i j;
multiply(a,&m,product);
printf("\n");
printf((" \nThe product is:");
printf("\n");
for(i=0;i<m;i<m;i++)
{
printf("\n");
for(j=0;j<m;j++)
printf(" %15.12f", product[i][j]);
}
printf("\n");
printf("n");
return(0);
}
I got the following error messages when I tried to compile it.
Error 1 error C2065: 'a' : undeclared identifier
Error 2 error C2065: 'm' : undeclared identifier
Error 3 error C2065: 'product' : undeclared identifier
Error 4 error C2448: 'multiply' : function-style initializer appears to be a function definition
Error 5 fatal error C1004: unexpected end-of-file found
Please help me I have been trying to figure out how to fix it.
Thanks
|
|
|
|
|
line #5 needs a semi-colon at the end.
|
|
|
|
|
There's several things wrong.
1/ You didn't read the posting guidelines, and put your code in pre tags, so there's no way on earth that I can be bothered to work may way through that wall of code.
2/ 1st error, as you've seen is a missing semi colon.
3/ 3rd error... When putting in tot prototype for your multiply function, you don;t say what kind of things a and m are. ints? doubles? struct Froobles?
OK, done now.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hello Team ;
I have a library file (.LIB) with Password protect it. I'm looking for a recovery software or application or anyway to recover the password.
Any thought....
Please reply...
Thanks for all of your help.
|
|
|
|
|
Password? A LIB file? Naaaaa. Unless you mean a LIB file that isn't an object library.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
That is correct. I do have a.Lib file and it is password protected. We would like to recover the password. so we can view the Lib ...
|
|
|
|