|
I tried the same thing but didn't got any error. Thus, if you can please share the code snippet, we may provide some inputs.
|
|
|
|
|
I use ::new and ::delete to alloc and dealloc GDI+ objects in vc6,
because of DEBUG_NEW. Will there be any problem?
modified on Sunday, December 16, 2007 12:52:18 PM
|
|
|
|
|
followait wrote: I use ::new and ::delete to alloc and dealloc GDI+ objects in vc6,
because of DEBUG_NEW
I don't understand the rationale behind this.
Could you explain?
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.
|
|
|
|
|
There will at least be a problem if you use any GDI+
methods that return pointers to newly allocated objects
(e.g. Graphics::FromHDC()). Those pointers shouldn't be deleted
with ::delete for sure.
It may be safe to use ::new and ::delete, but I personally wouldn't.
To ensure GDI+ is using its new operator, and still use DEBUG_NEW,
you can wrap your GDI+ "new" calls something like this:
#pragma push_macro("new")
#undef new
CClientDC dc(this);
Graphics *pGraphics = new Graphics(dc); <font color="#008800">
#pragma pop_macro("new")
Mark
Mark Salsbery
Microsoft MVP - Visual C++
modified on Sunday, December 16, 2007 2:00:01 PM
|
|
|
|
|
Thanks for your help before; however, the indicated page http://msdn2.microsoft.com/en-us/library/bwea7by5%28VS.80%29.aspx was not very clear. Basically:
If in my computer is an image file C:\diving\scubadiver.jpg
how would I tell Windows (without using class modes) to read in this image from the file and store it as plain decoded bits in an HBITMAP object whose handle is 'imagehandle'?
Ditto to write a bitmap image object to a file in .JPG mode, and how to specify the image quality parameter?
Ditto .GIF etc?
|
|
|
|
|
Anthony Appleyard wrote: Thanks for your help before; however, the indicated page http://msdn2.microsoft.com/en-us/library/bwea7by5%28VS.80%29.aspx was not very clear.
That is MFC.
Anthony Appleyard wrote: If in my computer is an image file C:\diving\scubadiver.jpg
how would I tell Windows (without using class modes) to read in this image from the file and store it as plain decoded bits in an HBITMAP object whose handle is 'imagehandle'?
I think there is no Win32 direct support for loading JEPG images. You can either search for a free JPEG library or use GDI+ (whose class Bitmap is able to load a JPEG and to return an HBITMAP ).
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.
|
|
|
|
|
Please, what is GDI+ and where do I get it and use it?
|
|
|
|
|
Windows Vista must be able to read JPG images, because its directory explorer can display thumbnails of them and say their image widths and heights.
|
|
|
|
|
Anthony Appleyard wrote: Windows Vista must be able to read JPG images
Of course.
I'm also quite sure that Vista is able to do a lot of other things.
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.
|
|
|
|
|
Specially if you know how to get ride of them :P
But atm... all what I have heard about Vista is not nice at all.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Nelek wrote: But atm... all what I have heard about Vista is not nice at all.
Oops, is the same that I heard about.
Maybe we have the same informer?
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.
|
|
|
|
|
It comes with the OS, starting with XP, and can also be
installed on OSs back to 98...
GDI+[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
See CXImage article on the codeproject I think it will be helpful for you.
|
|
|
|
|
Hello everyone,
In a class T, if there is a conversion opeator G, we always define it like this,
operator G()
without return type. So the implicit return type is G or G&? I can not find it in the C++ programming language book.
thanks in advance,
George
|
|
|
|
|
George_George wrote: In a class T, if there is a conversion opeator G, we always define it like this,
operator G()
The above is not true, you can do, as well
operator G &(){...}
of course the return type will be G in the former case, G& in the latter one.
BTW what book have you?
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.
|
|
|
|
|
Thanks CPallini,
I am always reading the book written by Bjarne. In the book, all conversion operators are defined as
operator G(),
example,
opeator int().
So, your points are, we can have both,
1. operaor G(), example operator int() -- returns a copy of object
2. operator G&(), example operator int&() -- returns reference
right?
regards,
George
|
|
|
|
|
Yes, but (probably) he never defines a operator G() (or operator G&() ) for class G (because, though legal, it is misleading and a bit weird).
Usually it is useful to have a conversion operator returning a related type, but not the type of the class itself, e.g. the LPCTSTR conversion operator of CString class .
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.
|
|
|
|
|
Hi CPallini,
Something wrong in your reply.
We should define conversion operator G() or G&() for class other than G, for example, class F.
CPallini wrote: Yes, but (probably) he never defines a operator G() (or operator G&()) for class G (because, though legal, it is misleading and a bit weird).
regards,
George
|
|
|
|
|
George_George wrote: Something wrong in your reply
OMG, I missed the class T at the very beginning of your OP . You're right.
George_George wrote: We should define conversion operator G() or G&() for class other than G, for example, class F
That's true and probably we (usually) prefer to define an operator G() rather than a G&() one.
As you pointed out, we should do that way, because defining the operator G() (or G&() ) for class G though legal, is misleading.
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.
|
|
|
|
|
Thanks for your clarification, CPallini!
regards,
George
|
|
|
|
|
If you mean "The C++ Programming Language" by Stroustrup, the reference in my copy (3rd edition) is on page 275, section 11.4 (Conversion Operators), where it says:
"Note that the type being converted to is part of the name of the operator and cannot be repeated as the return value of the conversion function."
If you want to return a G&, use operator G& .
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Thanks Mike,
Then we need to conversion operators,
1. type conversion operator;
2. type reference conversion operator.
Right?
regard,
George
|
|
|
|
|
Hi every one
how can i create one cpl file?
is there any compiler that crate cpl file?
please help me
|
|
|
|
|
Do you want to make Control Panel files(.cpl)?
|
|
|
|