|
Sir
I tried to reuse the code provided for creating thumbnails. But I am facing an issue. the image from the browsed path is not getting loaded to my bitmap object. I checked using breakpoints and found out that the path is being assigned correctly, but the object is not created.
Bitmap img(A2W(Path), 0);
The variable img is not getting initialized. Bitmap is a class in gdiplus. When this line of code is executed, the control must pass to the corresponding constructor of the class for initialization. But that is not happening in my program. I have included gdiplus.h in my program and also added gdiplus.lib. I am using Visual Studio 12.
Can you please help?
Thank you.
|
|
|
|
|
I had the same issue, i.e. the image didn't initialize correctly
First ensure that the GDI plus is working which even with the namespace listed as well as the gdiheader listed it still failed??
SO add this before the for loop
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR pGdiplusToken;
Gdiplus::GdiplusStartup(&pGdiplusToken, &gdiplusStartupInput, NULL);
( In for loop )
Image* pMyJpg = NULL;
USES_CONVERSION;
pMyJpg = Image::FromFile(A2W(
"c:\\test.jpg"));
pMyJpg->GetThumbnailImage(......); <---- this will work then.
(after for loop )
GdiplusShutdown(gdiplusToken);
|
|
|
|
|
strName = FindFileData.cFileName;
strExt = strName.Right(3);
if ( (strExt.CompareNoCase( TEXT("bmp") ) == 0) ||
(strExt.CompareNoCase( TEXT("jpg") ) == 0) ||
(strExt.CompareNoCase( TEXT("gif") ) == 0) ||
(strExt.CompareNoCase( TEXT("tif") ) == 0) ||
(strExt.CompareNoCase( TEXT("png") ) == 0) )
{
VectorImageNames.push_back(strName);
}
here if I have a file which simply doesn't have an extension name, and the file name is 'png' or *png your code here will deal it as a picture file,
I think
strName.Right(4);
CompareNoCase(_T(".bmp")) will work better,
sorry for my English,
Regards
David Feng
|
|
|
|
|
how can show the images mulityline?In your example,the image is show as only a line.thank you very much!
|
|
|
|
|
Could you send me new versionr regarding other image format ?
email: gianfranco.zuccaro@gmail.com
Thanks a lot,
Gianfranco
|
|
|
|
|
Please send me the updated code for loading other types of images.Ur code is really great.good job dude.My mail id is: rindam2002@yahoo.com.Please help me.
|
|
|
|
|
Hi,
Could you send me a version of the code that supports jpeg using gdi also?
Thanks,
Alan
muff1nt0p@yahoo.com
|
|
|
|
|
Hi
I am getting NULL value in pThumbnail
Bitmap* pThumbnail = static_cast<bitmap*>(img.GetThumbnailImage(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, NULL, NULL));
because of which i am not able to proceed further.
When i checked in Bitmap constructor
Bitmap img(A2W(strPath)) ;
The "lastresult" variable in that constructor is showing "gdpiNotInitialized"
Can anybody help in this regard
gkb
|
|
|
|
|
Me too
Someone solve the problem ?
mail : michelguillaum@yahoo.fr
Thanks a lot
|
|
|
|
|
GDI+ inititialize is needed.
ULONG_PTR m_gdiplusToken;
// initialize GDI+
GdiplusStartupInput gdiplusStartupInput;
GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);
...
process..
...
// release GDI+ resource
GdiplusShutdown(m_gdiplusToken);
|
|
|
|
|
Could you please send me the Updated Version (the one that allows other image formats using GDI+). It would be much appreciated. Thanks!
shirleyj002@hawaii.rr.com
shirleyj002@hawaii.rr.com
|
|
|
|
|
Why don't you just change it to use GDI+ ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello!
Your exemple is ok, but the thumbnail images from the list are very unclear.
Can I set these images to be more clear/sharp - something like add more contrast, similar with Windows Explorer thumbnail icon? I'm not use picture big screen preview, just the thumbnail list!
Any ideea will be apreciate!
|
|
|
|
|
Does anyone know where I can find and example similar to this in which other image formats can be added to an image list? I have searched codeproject, codeguru and other similar sites and have not found an example
|
|
|
|
|
I have sent you an updated code for this project to your E-mail address. That version supports various image format by using GDI+.
|
|
|
|
|
Do you have a version that works with visual c++ 6.0? If you do not I will try to convert the project to 6.0.
|
|
|
|
|
Dear yren~
I want to format by using GDI+ code,Can you sent me....
Thank you very much....
kmic88@yahoo.com.tw
|
|
|
|
|
I am also want to get a copy. Thank you very much.
My E-mail address is kungsin@gmail.com
|
|
|
|
|
Hi,
I would like to know is it possible to remove the file name of each thumbnail inside the list control.If so please explaine how?
Thanks and regards
Alvin
alwitta can help you always
|
|
|
|
|
The second parameter of Insertitem() function is the item's label. By passing that a NULL or TEXT(""), you will achieve the effect.
Yi
|
|
|
|
|
I'll post a updated version of the code that uses GDI+. That will allow you to open images with any format that GDI+ can handle.
|
|
|
|
|
would you like to send your code to me please?I want to load jpeg,but I
have no a idea how to implement it.
emal:lovelr1209@163.com
|
|
|
|
|
could you send me the new souce that can add other image format please?
my email is hypcsky@163.com
|
|
|
|
|
let me first say that the code is awsom but in visual studio 2005 the left and right mouch click code isnt working can someone help me to fix it
|
|
|
|
|
I never implemented the right mouse click event. The left mouse click should work.
|
|
|
|