|
ptr_Electron wrote: how to handle this friends
Fix it friend
led mike
|
|
|
|
|
Thanks for ur responce friend
|
|
|
|
|
Did you use of ANSI code?
|
|
|
|
|
Where we can get CImage sources (UNICODE COMPATIBLE) to load GIF, JPEG in our application ?
Anyone Please help on this.
Thanks a Lot
Thanks a lot
|
|
|
|
|
The source code is included with Visual Studio.
CImage uses GDI+ to load and save images. The loaded GDI+ image is converted to a DIBsection, which is
wrapped by the CImage class.
The loading code is similar to this (without the conversion to a DIBSection):
ULONG dwToken;
Gdiplus::GdiplusStartupInput input;
Gdiplus::GdiplusStartupOutput output;
Gdiplus::Status status = Gdiplus::GdiplusStartup(&dwToken, &input, &output);
if(status == Gdiplus::Ok)
{
Gdiplus::Bitmap *pSrcBitmap = new Gdiplus::Bitmap(L"C:\\test.jpg", FALSE);
<font color="Green">
delete pSrcBitmap;
Gdiplus::GdiplusShutdown(dwToken);
}
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Actually i am sure, there is no manual for CImage, in MS Visual Studio though it is included. If so what header i need to include to proceed?
Thanks for your response!
Thanks a lot
|
|
|
|
|
atlimage.h in VS 2008 - most of it is inline.
It used to be an MFC class so it was a different header file before.
What version of Visual Studio are you using?
If you don't have a VS version that has the class, you can always use GDI+ directly, as I showed in the sample code.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
you can find it on the its header file.
|
|
|
|
|
Does anyone here know a way of using the value of a constant class member in an #if condition.
What I'd like to do for example is :-
<br />
class CSomething<br />
{<br />
public:<br />
<br />
enum<br />
{<br />
E_IsCool = 1;<br />
};<br />
};<br />
<br />
<br />
#if (CSomething::E_IsCool)<br />
#else<br />
#endif<br />
<br />
This may seem unnecessary when there is only one CSomething but I have several different ones, some cool some not and then a typedef is used to give one of them the name that is actually used. I'm trying to avoid peppering the classes with #define s and #undef s
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
|
Yes it would normally and I've been thinking about using it. There is one small snag though. What if the conditional code is something like this:-
<br />
#if (CSomething::E_IsCool)<br />
#define _LONG_SUFFIX(_X) _X#L<br />
#else<br />
#define _LONG_SUFFIX(_X) _X<br />
#endif<br />
I can't find any way to pull in things like this that seem to have to be macros conditionally at the moment and I'm only really sold on going the template-mp route if I can do it all that way.
Nothing is exactly what it seems but everything with seems can be unpicked.
modified on Wednesday, April 2, 2008 10:59 AM
|
|
|
|
|
Matthew Faithfull wrote: This may seem unnecessary when there is only one CSomething but I have several different ones, some cool some not and then a typedef is used to give one of them the name that is actually used
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
|
|
|
|
|
I was trying to keep the example simple, obviously I failed .
<br />
class CSomething<br />
{<br />
public:<br />
<br />
enum<br />
{<br />
E_IsCool = 1;<br />
};<br />
};<br />
<br />
<br />
#ifdef USE_MYSOMETHING<br />
typedef CMySomething CSomething<br />
#else<br />
#endif<br />
<br />
<br />
<br />
#if (CMySomething::E_IsCool)<br />
#define _LONG_SUFFIX(_X) _X#L<br />
#else<br />
#define _LONG_SUFFIX(_X) _X<br />
#endif<br />
<br />
This is closer to what I'm really doing which is somewhat more complicated. It has to work on different compilers as that really is the point of this so any template tricks will need to be MSVC6 friendly
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Wow. So you don't know what a "pre" processor is in the context of a compiler?
led mike
|
|
|
|
|
Yes Mike I do know and am not expecting the example code I posted to work. I need something functionally equivalent to what it would do if it did work, i.e. if the PRE-processor was C++ aware. If you're telling me there's no way to control conditional compilation using compile time constants then just come out and say so.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Matthew Faithfull wrote: Yes Mike I do know
What, then why have you asked this question? I mean if you know then you know so why ask the question? Wait, now I remember trying to have a logical discussion with you in the SoapBox, never mind.
led mike
|
|
|
|
|
Yes, you didn't understand the use of a metaphor then and you clearly still don't.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Metaphor this you f***ing idiot
led mike
|
|
|
|
|
I see no alternatives to using define in your classes.
BTW why cannot you use USE_MYSOMETHING to distinguish between suffixes?
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
|
|
|
|
|
You may be right I was hoping someone would have a brainwave.
The reason I wouldn't use USE_MYSOMETHING is because it isn't really that simple, that would be the equivalent of one case in a page long block of #if #elif #endif code, not something I'd want to repeat in more than one place. I'm left with using that lump of code to #define yet another symbol e.g. USE_SUFFIXES and then using that. It's what everyone else does but I was hoping to improve on the state of the art
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Matthew Faithfull wrote: It's what everyone else does but I was hoping to improve on the state of the art
You should stick with learning the current state of the art before you decide to try and improve it.
led mike
|
|
|
|
|
Where were you I wonder when I successfully ported Jaakko Järvi's tuple class to MSVC6, 9 months before the Boost developers managed it?
If you don't have anything useful to contribute you should stick to the Soapbox or better yet not post.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Yeah try to prove you know what you are doing by citing some project you did, good one. To late, the cat's out of the bag now.
Matthew Faithfull wrote: you should
What? I should what, take your advice? When hell freezes over dude, when pigs fly, when bears sh*t in the woods, when, wait, well you get the idea.
led mike
|
|
|
|
|
The preprocessor doesn't work like that. It just sees text and has no knowledge of the value of E_IsCool. You'll need to do something like (just the snippets here):
#define E_IS_COOL_VALUE 1
enum { E_IsCool = E_IS_COOL_VALUE };
#if E_IS_COOL_VALUE != 0
|
|
|
|
|
Yes, I realize the preprocessor isn't going to cut it. I wondered if there was any other mechanism to get the compiler to conditionally ignore/notice chunks of code with a similar effect to the preprocessor but during actual compilation. For the moment I've worked round it but in the longer run that's going to mean defining things in multiple places which is not exactly splendid. Anyway you can see how it works out as this is part of what will almost certainly be my next article, the Compiler abstraction library I ranted at Marc Clifton about nearly a year ago, expect it any time in the next 12 months
Thanks.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|