|
I tried your project and encountered a "ASSERT FAILED" at the FUNCTION:"BOOL CPictureShowDoc::CreateFilesList()" at line: " if(m_Finder.IsDots() || m_Finder.IsDirectory()) m_Finding = m_Finder.FindNextFile();
"
Perhaps you can do like this:
"
while(m_Finding == TRUE)
{
m_Finding = m_Finder.FindNextFile();//Must do this at first.
if(m_Finder.IsDots() || m_Finder.IsDirectory()) continue;// m_Finding = m_Finder.FindNextFile();
else // It Is a File...
{
// Get The Extention Of The Current Handled File
Extention.Format("%s", FileExtentionOnly(m_Finder.GetFileName()));
Extention.MakeUpper(); // Just In Case (Sensitive)...
// Add To The List
if(IsWantedExtention(Extention)) m_FilesList.AddTail(m_Finder.GetFileName());
}
}
"
Thanx for your code.
|
|
|
|
|
check out the fix 4 that,
couple messages before U
(on this forum):
"Re: Error When Use CPicture"
|
|
|
|
|
At first ,my program is written in Debug version,your program is Release version.If I switch your program into Debug version,your program can bulid,link,but cannot exe.I added your some codes into my program from your program,the following errors appeared:
Debug Assertion Failed
program:G\my project\WorkTemplate\Debug\WorkTemplate.exe
File:objcore.cpp
Line:43
For infomation on how your program can cause an assertion failure,
see the the Visual C++ documentation on asserts.
(Press Retry to debug the application)
here are Abort Retry Ignore three buttons
If I click the Retry,the following words appeared:
unknown software exception(0x80000003),lies at 0x00498a92
|
|
|
|
|
Check this out:
http://codeguru.earthweb.com/mfc/comments/46836.shtml
Best Regards - Yovav Gad
EMail: Dev@OMyGad.com
Web-Site: www.OMyGad.com
|
|
|
|
|
Hi,
I have a question. How I get all the pixels from the CDC if that active window don't show all the image or is Minimize. Many of these images appereance cut.
Thanks
|
|
|
|
|
I tried with a jpeg. The program crashed when loading the jpeg (When OleLoadPicture was called for the second time). It managed to display the jpeg (first time) but crashed the second time.
|
|
|
|
|
I have the sample jpeg with me.
|
|
|
|
|
Hi yovav,
Thanks for your fast response. What I did was I modified the program. I added a new menu item called DisplayImage. Once I click on the menu item, it will make a call to CPicture::Load function. I'm actually testing the CPicture class.
void CMainFrame::OnDisplay()
{
// TODO: Add your command handler code here
CPicture cPicture;
cPicture.Load("c:\\inetpub\\ftproot\\live\\image_cam1_735.jpg");
//rendering goes here
}
It succeeded on the first call. When I did it for the second time, it crashed at cPicture.Load(..) function (in OleLoadPicture). Only happen when I run the program (Ctrl-F5), doesn't happen when I debug it (F5). It doesn't happen for all the jpegs file. Only certain jpegs. Any idea ? Thanks.
|
|
|
|
|
you can modify
BOOL CPictureShowDoc::CreateFilesList() to solve crash problem:
after line
m_FilesList.GetHeadPosition();
insert the follow two lines
if (m_Finding)
m_Finding = m_Finder.FindNextFile();
|
|
|
|
|
Hi Yovav!!!
I`m Cristian, I`m the guy who is performing the proyect of "displaying
images" (CODE PROYECT Web Site). I want to thank you your help an your
advices but I couldn`t obtain the image showned in the picture...well
Now I have other problem which I need to solve and I want to know if you can
give me an idea or advice.
I need to take a photo from a web cam,in this case the program can do it
already, it make it when a button of the aplication is pushed with the
mouse. But now, I need that the photo be taken for an external signal, I
mean from the parallel port or serial port...is it correct???
Do you know if there is a class or funtion which can handle the parallel, or
serial port???
Thanks and best Regards.
Waiting for your response CRISTIAN
If yo want I can send you the program, it`s good but it`s only for logitech
WebCams.
|
|
|
|
|
I did not mess with that stuff yet,
check out the www.CodeGuru.com forums...
Best Regards - Yovav Gad
EMail: Dev@SuperMain.com
Web-Site: www.SuperMain.com
|
|
|
|
|
Hi Yovav!!!
I`m relly very thankful for your faster response, I have made as you suggest, but as I said before, I´m beginner in VC++, and I thought that I didn`t follow your instruction correctly...(I don`t know why I taken this trouble!!! ).
Any way, here is the piece of code that I modified, and one more time thaks for your attention.
By the way..your website is genial!!!!
NOTE.- If you have time, Could I send you the complete program, it`s too good, only miss the part to shown the image stored. and I hope that you can help me whit this. Waiting for your response....Cristian
//This is the OnPaint method
void CBadgeMakerDlg::OnPaint()
{
CPicture m_Picture;
BOOL checa=TRUE;
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
//this is the part modified by me
if (checa=TRUE){
/////show the picture
m_Picture.UpdateSizeOnDC(&dc); // Get Picture Dimentions In Pixels
m_Picture.Show(&dc, CPoint(0,0), CPoint(m_Picture.m_Width, m_Picture.m_Height), 0,0);
m_Picture.Show(&dc, CRect(0,0,100,100)); // Change Original Dimentions
}
else (checa=FALSE);
}
else
{
CDialog::OnPaint();
}
}
//and this is the funtion modified again
int CBadgeMakerDlg::OnBadge2()
{
CPicture m_Picture;
//CPaintDC dc(this);
BOOL checa = TRUE ;
HWND hwnd;
//////////load a picture from a file
checa= TRUE;
m_Picture.Load("c:\\FotosPrueba1\\image1.bmp"); // Load From a File - Just Load It (Show Later)
InvalidateRect(hwnd, NULL, TRUE);
return 0L;
}
NOTE.- When I compile the program only one error appears
|
|
|
|
|
this is not very complicated,
but U have to know how 2 do this:
both CPicture m_Picture; and BOOL checa;
should be defined in the header file of your main program
(.h)
it is called "member variable",
this member (m_Picture) is the same for all functions...
so if U update it on: OnBadge2()
it will still remain in OnPaint()
the OnPaint() is actually your paint event,
so U should use it to show things on the screen
(by calling Invalidate / InvalidateRect ...)
same goes for BOOL checa
and U should also initialize 'em both in the constructor
Best Regards - Yovav Gad
EMail: Dev@SuperMain.com
Web-Site: www.SuperMain.com
|
|
|
|
|
Hi!!!
I`m beginner in VC++, I`m need to know how can I display an image in a picture from a file, this is because I`m capturing an image from a webcam and it is stored as bmp format and displayed in a picture.
Now, I need to show the same image in other picture, because I will compare them...so, I need to have both images in the aplication.
I`m using the Picture library taht you published, but I don`t know if thus is the correct way...the code is below (OnBadge2 is the name of the picture of VC++).
NOTE: when I compile my program, any error appears, but the image doesn`t show in the picture...
thank you in advance faithfully Cristian!!!
void CBadgeMakerDlg::OnBadge2()
{
CPicture m_Picture;
CPaintDC dc(this);
//////////load a picture from a file
m_Picture.Load("c:\\FotosPrueba1\\image1.bmp"); // Load From a File - Just Load It (Show Later)
/////show the picture
m_Picture.UpdateSizeOnDC(&dc); // Get Picture Dimentions In Pixels
m_Picture.Show(&dc, CPoint(0,0), CPoint(m_Picture.m_Width, m_Picture.m_Height), 0,0);
m_Picture.Show(&dc, CRect(0,0,100,100)); // Change Original Dimentions
}
|
|
|
|
|
Your program is probably using the OnPaint() event,
so U better just Load() it on OnBadge2(),
but Show() it on OnPaint(),
1. put Load() in OnBadge2(),
2. put Invalidate() or InvalidateRect() in OnBadge2()
so it will call the paint event,
3. add a member "flag" (FALSE) variable and when OnBadge2()
is activated make it TRUE,
4. in the paint event check if your flag is TRUE,
if so - use Show() to show picture on the correct
paint event, and set the flag back to FALSE again...
good luck.
Best Regards - Yovav Gad
EMail: Dev@SuperMain.com
Web-Site: www.SuperMain.com
|
|
|
|
|
IPicture will change the width and the height of a picture loaded!
why?
who could tell me the way to operator the jpg file map?thanks !!
|
|
|
|
|
U can use the Show() function 2 show Regular size
or "Streached" size,
maybe your scolling area has changed,
if U want, send me your project zipped and specific info...
Best Regards - Yovav Gad
EMail: Dev@SuperMain.com
Web-Site: www.SuperMain.com
|
|
|
|
|
IPicture can't use in the map mode of MM_HIMETRIC ,MM_LOMETRIC .......
|
|
|
|
|
Hello,
Iam not sure if its related exactly to this tutorial...
I have a dialog based application with static control.
and a browse button. I want to load a bitmap from a .bmp file to the static control.
I have a DC to the control but I keep failing to load the bitmap how can I do it?
thanks
Yair
|
|
|
|
|
if U have DC 2 this control than it should work,
(maybe U need to Invalidate() your control)
or maybe U use the DC not correctly
(is it a pointer - &dc or an object - dc)
if U want, send me the source...
Best Regards - Yovav Gad
EMail: Development@SuperMain.com
Web-Site: www.SuperMain.com
|
|
|
|
|
thank you I sent you the code now...
thanks
Yair
|
|
|
|
|
Dear all,
First-chance exception in PictureShow.exe (GDI32.DLL): 0xC0000005: Access Violation.
First-chance exception in PictureShow.exe (GDI32.DLL): 0xC0000005: Access Violation.
|
|
|
|
|
I know there is a problem to pass compile on DEBUG mode
is this your problem ?
Try 2 replace this function in your CPictureShowDoc.cpp (CPictureShowDoc::CreateFilesList())
I think these two lines may fix it,
// 10X 2 Mr.Christian Wagner 4 His Help 2 Avoid An Assertion On Debug...
m_Finding = m_Finder.FindNextFile(); // Must Be Called Once Before IsDots()
Please let me know if it worked...
//-----------------------------------------------------------------------------
BOOL CPictureShowDoc::CreateFilesList()
//=============================================================================
{
m_Finding = m_Finder.FindFile("*.*"); // Finds All Files (By Name)
CString Extention;
m_FilesList.RemoveAll(); // Clear - In Case We Created Another List...
m_FilesList.GetHeadPosition();
while(m_Finding == TRUE)
{
// 10X 2 Mr.Christian Wagner 4 His Help 2 Avoid An Assertion On Debug...
m_Finding = m_Finder.FindNextFile(); // Must Be Called Once Before IsDots()
if(m_Finder.IsDots() || m_Finder.IsDirectory()) m_Finding = m_Finder.FindNextFile();
else // It Is a File...
{
// Get The Extention Of The Current Handled File
Extention.Format("%s", FileExtentionOnly(m_Finder.GetFileName()));
Extention.MakeUpper(); // Just In Case (Sensitive)...
// Add To The List
if(IsWantedExtention(Extention)) m_FilesList.AddTail(m_Finder.GetFileName());
m_Finding = m_Finder.FindNextFile();
}
}
// Handle The Last File...
Extention.Format("%s", FileExtentionOnly(m_Finder.GetFileName()));
Extention.MakeUpper(); // Just In Case (Sensitive)...
if(IsWantedExtention(Extention)) m_FilesList.AddTail(m_Finder.GetFileName());
m_Finder.Close();
// Get First Object On The List
// Do Not Use pApp->m_lpCmdLine Coz It Will Not Get Updated When OnFileOpen...
m_FilesListPosition = m_FilesList.GetHeadPosition();
m_FilesListPos = 1; // Coz We Are On The First Object On The List...
m_FilesListCount = m_FilesList.GetCount();
CString Clicked; // Make Sure We Count Spaces And UNICode...
Clicked.Format("%s", m_FilePathName);
// If File Was Clicked - Begin List Count From This File
if(Clicked.GetLength() > 0)
{
// Take Out Path Info...(Leave Only FileName)
Clicked.Format("%s", FileNameOnly(Clicked));
// Check If We Talking About a Wanted Extention
Extention.Format("%s", FileExtentionOnly(Clicked));
Extention.MakeUpper(); // Just In Case (Sensitive)...
// Check If It One Of These
if(IsWantedExtention(Extention))
{
for(int I=1; I < m_FilesListCount; I++) // Coz Starting From 1
{
Extention.Format("%s", m_FilesList.GetAt(m_FilesListPosition));
if(Clicked.CompareNoCase(Extention) == 0) break; // We Got It
m_FilesList.GetNext(m_FilesListPosition); // Move On The List
m_FilesListPos++;
}
}
}
/* DEBUG
CString S;
// Be Careful - Can READ List Objects If Not Exists
if(m_FilesListCount > 0)
{
S.Format("%d Picture Items On This Directory\t\nClicked = %d", m_FilesListCount, m_FilesListPos);
AfxMessageBox(S);
S.Format("First = \"%s\"", m_FilesList.GetAt(m_FilesListPosition));
AfxMessageBox(S);
}
if(m_FilesListCount > 1)
{
S.Format("Last = \"%s\"", m_FilesList.GetTail());
AfxMessageBox(S);
}
*/
return(TRUE);
}
Best Regards - Yovav Gad
EMail: Temp@Yovav.com
Web-Site: www.Yovav.com
|
|
|
|
|
I have had a compiling error:
PictureShow\PictureShow.rc(388) : fatal error RC4214: Codepage not valid
And I checked the code it is about the language used as shown below:
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HEB)
#ifdef _WIN32
LANGUAGE 0xD, 0x1 // This line caused the trouble.
#pragma code_page(1255)
#endif //_WIN32
...
Maybe I have missed something. Can anyone help?
kes
|
|
|
|
|
1. what Windows do U use ?
2. try to delete all temporary files
plus the project .ncb file
and rebuild all...
Best Regards - Yovav Gad
EMail: Temp@Yovav.com
Web-Site: www.Yovav.com
|
|
|
|
|