|
Well, 10X
Best Regards - Yovav Gad
EMail: Yovav@SuperMain.com
Web-Site: www.SuperMain.com
|
|
|
|
|
Thanks for the great class it works perfect!
But can you make it support PNG too, or is that just not possible??
If not I just use GIF, but really like to use PNG instead.
Thanks again, great work. It's a lot easier to use then for example CxImage.
|
|
|
|
|
Hello Yovav!
I'm new to C++ program, i would like to ask how to change the icon and the default picture of "Picture Show?
Best Rgds,
Martin
|
|
|
|
|
That's easy.
The Icon:
Fire up Visual C++ and open PictureShow.dsw, then go to the resource tab.
Open up the Icon section and double click on IDR_MAINFRAME.
You can edit the icon now.
The Image:
Same thing, but now go to the "JPG" section... just replace IDR_DEFAULT with the JPG you want.
(open up your desired JPG in a HEX editor and copy/paste the data into that IDR_DEFAULT thing)
|
|
|
|
|
Yea, as Mr.Before U just said,
+ U may not see more than 256 colors on VC6,
anyway - it will show true color on program
(if windows support it...)
Best Regards - Yovav Gad
EMail: Yovav@SuperMain.com
Web-Site: www.SuperMain.com
|
|
|
|
|
When I open several Internet Explorer, my application program using CPicture class maybe popup: Cannot allocate enough memory! How to solve this problem?
Thanks!
|
|
|
|
|
Buy more memory
Best Regards - Yovav Gad
EMail: Yovav@SuperMain.com
Web-Site: www.SuperMain.com
|
|
|
|
|
Look, in the function where you call the CPcture::Show function(maybe OnPaint or OnDraw),if you forgot to call the CPicture::UpdateSizeOnDC(CDC *pDC) function before that.The same problem appeared at me and was wondering what exactly is wrong because I have more than enough memory, until I saw that I missed to call CPicture::UpdateSizeOnDC(CDC *pDC) before the CPcture::Show function.I hope that now your problem is solved.;)
Best regards,
Milcho
|
|
|
|
|
I get this output while running PictureShow
First-chance exception in PictureShow.exe (GDI32.DLL): 0xC0000005: Access Violation.
First-chance exception in PictureShow.exe (GDI32.DLL): 0xC0000005: Access Violation
Is this a serious error or can it be Ignored?
Another poster has mentioned about this error. but no response for this.
Yovav can you please look into this?
I want to know because my program is crashing afterwards
Thanks in Advance.
|
|
|
|
|
This is repost of a message by Henry P from another CodeProject thread.
Since I am also facing the problem, I am just putting it here to get the attention of the knowledged.
Any information on how this problem can be solved is sincerely requested.
------------------------------------------------------------------------
Another minor issue. OleLoadPicture (from the MSDN sample LoadPic.exe) works beautifully when the display is set at 24 or 32-bit color mode. But on 16-bit displays, the image quality is significantly degraded, more so than you'd expect. For comparison, I used a graphics program to open the same image and it looks much better even at 16-bit. See screen shots here:
http://www.allersoft.com/files/oleloadpicture.htm
One interesting thing is that the output of LoadPic.exe is dependent on the display color mode at the time the program started. If you switch color modes while the program is running, that has no effect. It seems that OleLoadPicture internally downgrades the image to 16-bit if the program is run on a 16-bit display. Is there anyway to prevent this?
|
|
|
|
|
http://www.codeproject.com/bitmap/cpicture.asp
It's pretty much the same class (can't tell if Yovav's copied Hendrix, the other way around, or if they were both inspired by a third source) but Hendrix's code is, in my eyes at least, much cleaner and features fewer annoying and misspelled comments.
The supported file formats and the basic functionality is exactly the same as far as I can tell. I suggest anyone looking at Yovav's CPicture take a look at Hendrix's as well. I have made some improvements to the code myself and will be publishing it soon on my own web page (see signature).
[ PlanetCPP ][ home of the n00blist ]
|
|
|
|
|
I just finished rolling up my own version of the CPicture class.
The result, should you be interested in it, is available for download at my website, PlanetCPP, in the "Get Code" section. My version of CPicture is released under the GPL license.
Please let me know what you think!
[ PlanetCPP ][ home of the n00blist ]
|
|
|
|
|
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
|
|
|
|