|
#include <tchar.h>
Stupid HTML
|
|
|
|
|
See here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Well, you need to include an header file. As already pointed out by David Crow, the documentation [^] states clearly what you need in the requiremens section.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
An App dialog is being written that has variables declared as public in the AppDlg header file. Other dialogs used for tab sheets will required access to these variables.
Are there any good tutorials on how to do this using multiple dialogs that were generated in MSVC++6? Plain CPP isn't a problem, but getting the right initializations for the MFC derived dialogs for these variables eludes me at present.
Thanks in advance for any leads.
-jon
|
|
|
|
|
If the variables in question are members of the CWinApp -derived class, you can access them via the theApp object.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Well, MFC are indeed 'plain' C++ (BTW C++ is 'plain' by no means).
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am using this code for comparing bitmaps.
it is compiling without error but when we execute it just a blank window arrives with a error message and ask to close the program.
Can anyone see what is the solution for this code.
void CPixelView::OnDraw(CDC* pDC)
{
CPixelDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
{
COLORREF color[255][255],color1[255][255];
CBitmap bitmap,bitmap1;
CString file1,file2,strText;
file1.Format("C:\\1.bmp");
file2.Format("C:\\3.bmp");
CDC dcMemory,dcMemory1;
int r[255][255],R[255][255];
HBITMAP hBitmap1 = (HBITMAP)::LoadImage(NULL,file1,IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE );//| LR_CREATEDIBSECTION);
HBITMAP hBitmap2 = (HBITMAP)::LoadImage(NULL,file2,IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE );
// Attach the loaded image to the CBitmap object.
bitmap.Attach(hBitmap1);
bitmap1.Attach(hBitmap2);
dcMemory.CreateCompatibleDC(pDC);
dcMemory1.CreateCompatibleDC(pDC);
dcMemory.SelectObject(&bitmap);
dcMemory1.SelectObject(&bitmap1);
pDC->BitBlt(0,0,200,200,&dcMemory,0,0,SRCCOPY);
pDC->BitBlt(300,300,700,700,&dcMemory1,0,0,SRCCOPY);
//for all the pixels
for(int i=0;i<48;i++)
{
for(int j=0;j<48;j++)
{
HDC hDC = ::GetDC(this->GetSafeHwnd());
HDC hDC1 = ::GetDC(this->GetSafeHwnd());
color[i][j] = ::GetPixel(hDC,i,j);
::ReleaseDC(this->GetSafeHwnd(), hDC);
r[i][j]=GetRValue(color[i][j]);
color1[i][j] = ::GetPixel(hDC1,i,j);
::ReleaseDC(this->GetSafeHwnd(), hDC1);
R[i][j]=GetRValue(color1[i][j]);
}
}//got the pixel values
}
}
Thank You
kaushal kishore sharma
|
|
|
|
|
kaushal kishore sharma wrote: it is compiling without error
Compilers don't catch errors like say, null pointer errors. Try debugging your code to find the problem.
led mike
|
|
|
|
|
thank you led mike.
i have done debugging of the program it is giving stack overflows dialog.
so you can check the code where it is giving me this error. My main moto is to compare bitmaps if you have any code related to this field do help me.
I will be very thankful to you.
Thank You
kaushal kishore sharma
|
|
|
|
|
|
Why are you selecting bitmaps into memory DCs, but then getting window DCs
to get pixel values from?
Where is the error occurring?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thank you sir.
i am doing my selecting bitmap work using memorydc since beginning.
i do not myself, where is the problem. It is executing but giving blank window and a dialog box written "pixel MFC Application has encountered a problem and needs to close. We are sorry for the inconvenience."
and after this i click on debug then it is giving "Stack overflow"
so please help me.
Thank You
kaushal kishore sharma
|
|
|
|
|
kaushal kishore sharma wrote: i do not myself, where is the problem.
Then how do you know the problem is in the code you posted?
Like others have mentioned, you need to debug this.
Put a breakpoint at the start of your posted code and step
through line by line.
Are the LoadImage() calls succeeding?
Are the SelectObject calls succeeding?
Are any calls succeeding?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I've read this thing: http://www.codeproject.com/KB/winsdk/console_event_handling.aspx[^]
but it's still not clear where i put the codes...
the main idea is:
that the user is not possible to close the console window by pressing X.
Please help me, i've spend houres searching
|
|
|
|
|
Hi all,
I have a new problem...I'm trying to do a matrix of rectangles in my drawcli like application, I have created my own rectangle class CRectangle and I'm trying to draw on screen a matrix of 640x480 rectangles. My problem is the slowness of the application. I have implement a for loop to draw on screen the rectangles, and I have store the matrix of rectangles in a CTypedPtrList. Could you give me any ideas to make the application going faster?
The code is pasted below:
In this part I implement the matrix of rectangles and I store it in the CTypedPtrList
void CGOEView::OnElementiCaricamatrice()
{
if(rMatr==0)
{
CGOEDoc* pDoc = GetDocument();
int x=50;
int y=-60;
rMatr++;
m_pTempElement=0;
CClientDC aDC(this);
OnPrepareDC(&aDC);
for(int j=0;j<480;j++)
{
for(int i=0;i<640;i++)
{
CPoint* m_FirstPoint=new CPoint(x,y);
CPoint* m_SecondPoint=new CPoint((x+2),(y-2));
m_pTempElement=new CRectangle(*m_FirstPoint,*m_SecondPoint,pDoc->GetElementColor(),m_DimPen);
pDoc->AddElement(m_pTempElement);
m_pTempElement=0;
delete m_pTempElement;
x=x+3;
}
y=y-3;
x=50;
}
}
}
Then in the part of the code pasted below I draw the rectangle element on screen:
void CGOEView::OnDraw(CDC* pDC)
{
CGOEDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
CElement* mElement=0;
if(rMatr!=0)
{
POSITION bPos = pDoc->GetHeadElectrode();
while(bPos)
{
mElement = pDoc->GetNextElectrode(bPos);
TRACE( "The value of x is %d\n", rMatr );
if(pDC->RectVisible(mElement->GetBoundRect()))
{
sel=FALSE;
mElement->Draw(pDC,m_pSelected,sel);
}
}
}
}
Thank for the help
|
|
|
|
|
that is a windows painting 101 issue. You need to study double buffering. Sometimes in Windows/MFC it's called working with a memory DC
CreateCompatibleDC[^]
Google search[^]
led mike
|
|
|
|
|
Thank you very much it resolve almost all the problems...now I have only a great memory leakage to erase. Could you help also with this problem?
|
|
|
|
|
Laan82 wrote: Could you help also with this problem?
Not sure what help you need, here is a guess.
Anytime you use new to allocate heap memory there needs to be a corresponding delete .
Laan82 wrote: CPoint* m_FirstPoint=new CPoint(x,y);
CPoint* m_SecondPoint=new CPoint((x+2),(y-2));
led mike
|
|
|
|
|
thank you the problem is exactly this I take care only of the problem derived from my list and I don't think of the problem derived from the pointer at the point Thank you very much!
|
|
|
|
|
Hi,
I'm trying to distribute an application that i made:
The first step was to find a way to create an installer: for now i found ISTools, seems ok for me.
I tested it and worked fine, but when i tried to install the application in an other PC Without VStudio installed, it doesn't worked.
After some tests i realized that the problem has something to do with visualstudio properties because I've created a simple HelloWorld program in VisualStudio 2005 and this simple program works fine in the PC where it was created (it has the VisualStudio Installed), but when I try to execute the release *exe created in an other PC (simply copying the exe file to the other PC), it doesn't worked: And gives the flowing error:
"It's not possible to initiate the application because the application is not well configured. The re-installation of the Application may resolve the problem"
(this is the translation from the Portuguese text).
Is there is something more that i've to install? Is there some configurations that i've to make?
The both OS are windows XP.
Thanks in advance,
Filipe Apóstolo
|
|
|
|
|
Have you seen this?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Ok that worked, i've installed the package.
Tanks.
However the first sample application that uses Gtkmm (doesn't worked), but in this case I've installed GTK+ and Gtkmm runtime packages. Now I'll try to find why.
Tank you!
|
|
|
|
|
will the same work for vc++ 6.0 also?
|
|
|
|
|
Did you fail to notice the big Visual C++ 2005 mentioned several times in that article?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
No Idin't . I found the problem, it was the runetime versions packages that dint matched. Now its fine.
But thanks for your Help
|
|
|
|