|
I know this is a stupid question but: how do I link (or include) only resource files within my project?
Jay
|
|
|
|
|
can you provide some little more details about what you have and what you need please ?
|
|
|
|
|
sorry, i wanted to link source files
|
|
|
|
|
Jay Minor wrote: ...resource files...
Which is what exactly?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Do you want to insert resource file(rc) to your project?
|
|
|
|
|
i ment linking surce files (.cpp) not .rc files
|
|
|
|
|
still you don't provide much infos, so i can't help
|
|
|
|
|
If you want to add a cpp file to your project you can right click on the Solution Explorer of your project and choose Add->Add New Item and select c++ file to Create a source file,Is your intent?
|
|
|
|
|
my intent was to include it in the actual program (not just the project)
|
|
|
|
|
Whats meaning of "actual program " again if you want to include a exist cpp to your project you can use of Add Exsiting Item you can include cpp but if it doesnt your answer more explain
|
|
|
|
|
this is what i dont want to do: #include "c:/.....", since i can (like u said) add an existing item to my project, so instead of typing the file path all the time, cant i just do something like #include "filename.cpp" wich is already in the project?
|
|
|
|
|
Im sorry but I dont understand what you said can you more explain but a thing you must inlcude filename.h not filename.cpp
|
|
|
|
|
I want to set the back ground color for my SDI main frame using MFC. I don't know how?
|
|
|
|
|
The easiest way is to add a WM_ERASEBKGND handler to the window class. In response to the
message, draw the background in the color of your choice:
BOOL CMyFrameWnd::OnEraseBkgnd(CDC* pDC)
{
CBrush bkBrush(RGB(0xFF,0x00,0x00));
pDC->SelectObject(bkBrush);
CRect CliRect;
GetClientRect(&CliRect);
pDC->PatBlt(CliRect.left, CliRect.top, CliRect.Width(), CliRect.Height(), PATCOPY);
return TRUE;
}
Another way is to register a window class (instead of using the default) and in the WNDCLASS
struct set the hbrBackground member to a brush of the desired color.
Note that if your main frame has a view in it then you need to do this in the view class, not the
frame class.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I add OnEraseBkgnd as you suggest in my main frame class, and when I launch my window application I see the red back ground flash quickly and then back to white back ground. Do you know why? Thanks
|
|
|
|
|
gurucplusplus wrote: Do you know why?
Yes, because you should have done it in the view class
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I got it. Thanks. But I have another question. I want to draw lines and rectangle box as overlay to exiting image display on main window frame. How can I do it? I currently can drawing lines, rectangle box on my image as I use mouse left and right mouse buttons. but what I did is to draw onto the image but not on graphic overlay frame. Thanks.
|
|
|
|
|
As with the background, if you have a view in the frame then you do your drawing there instead of
on the frame window - otherwise it will be "covered" by the view window like when you saw the
frame background window flash.
Typically, you'd do your drawing in response to a WM_PAINT message, after the image has been
drawn. If it's a CView-derived class, overriding OnDraw() may be a more appropriate place,
especially if the base class draws the image in OnDraw().
Either way, this means you need to store the coordinates (or whatever info is necessary) to redraw
everything every time repainting is necessary (when WM_PAINT is received).
How is the image being rendered in your case?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I am new to MFC/VisualC++ 6.0. Can you point me few examples of how to draw graphic overlay in MFC?
|
|
|
|
|
Do you have an image that's already being drawn? If so, how is being done? With a little
more specifics I think I can give you a more specific example
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I load the image from disk using IPicture renderring. This is my OnDraw(CDC* pDC) from CView class:
CMyDoc* pDoc = this->GetDocument();
ASSERT_VALID(pDoc);
HPALETTE hPal;
pDoc->m_pPicture->get_hPal(reinterpret_cast<ole_handle *="">(&hPal));
CPalette *pPalOld = NULL;
if (hPal != NULL)
{
TRACE(_T("CXpiProView::OnDraw - RealizePalette\n"));
pPalOld = pDC->SelectPalette(CPalette::FromHandle(hPal), FALSE);
pDC->RealizePalette();
}
RECT rc;
this->GetClientRect(&rc);
// display picture using IPicture::Render
pDoc->m_pPicture->Render(pDC->GetSafeHdc(),pDoc->m_sizeInPix.cx,
pDoc->m_sizeInPix.cy,0,pDoc->m_sizeInHiMetric.cy,
pDoc->m_sizeInHiMetric.cx,-pDoc->m_sizeInHiMetric.cy,&rc);
|
|
|
|
|
I have a number of very mature applications and I'm taking the big leap to Vista and Visual Studio 2005. Previously I used VC6 and XP. I got VS2005 installed with SP2. Got my application to compile and execute. So far so good.
I need to have the application run on XP, NT, etc. Previously with VC6 this was no problem. I just copied the EXE and the correct MFC DLLs to the target machine and it all worked. From windows 98 and on it all worked fine.
Problem is something isn't the same and I don't know the magic. I complied my app with VS2005, copied the EXE and the two MFC DLLs (MFC80.DLL and MSVCRT.DLL) to my XP machine and when I try and start it up, the obscure message "The application failed to initialize properly (0xc0000142)" appears.
Anyone know what this means and how to fix whatever the heck is wrong?
Kimberly
|
|
|
|
|
hcatech wrote: Anyone know what this means and how to fix whatever the heck is wrong?
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You need to run the vcredist_x86.exe installer on the other machine.
|
|
|
|
|
Thanks Mike.
I installed the windows installer on the XP machine and then downloaded and ran the vcredist exe you recommended. All appeared to go well. Problem is the application still doesn't work. The message I get is:
"The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem"
It's just a single EXE and all this shouldn't be this hard....
Any ideas?
|
|
|
|