|
Actually I like very much the CLR.
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
[My articles]
|
|
|
|
|
I can't declare a function like this:
GraphicsPath GetPath();
It's not convenient, so what is the benifits?
|
|
|
|
|
I imagine it's because GDI classes just wrap a raw handle to the object inside Gdiplus.dll. The constructor creates the handle, and the destructor closes it. As there's no hint of reference counting, copying the classes is just begging for errors.
This protects you.
I've been doing a bunch of GDI+ work recently, and what I did in some code I wrote yesterday was:
BOOL CreateArrowCap (GraphicsPath &path, float fSize)
{
...
}
I used the reference rather than a pointer, as it makes little sense to pass NULL. But it would be valid in other circumstances.
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
i want to compress some image file created in my project and store it. for future use and whenever its needed unzipped the stored file.
please any one let me know how i will do that and is it microsoft MFC has provide any API for that.
Thanks in advance.. 
|
|
|
|
|
|
Thank You,
Hamid
That is exactly I am looking for.
Thanks again for your valuable and quick response
Regards,
Ashish 
|
|
|
|
|
Plug: You can please, click the "Good Answer" link on his reply to you.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Ok,
i clicked on the link
Thanks for remind me
|
|
|
|
|
The only thing that I can think of, from Microsoft, on these lines is the CAB SDK[^]. But I see you are wanting to compress image files, so I do not know what good can cab compression do for you.
There is no standard way of creating a zip compressed file using MFC or Windows API. I believe the .NET framework has this feature though. There is also the LZMA SDK[^] which can compress to .7z format, if you'd like it. The compression would be better than zip (and even rar) and the library works like a charm.
Almost all compression utilities can extract from .7z files, so you don't have to possibly worry on the compatibility front too.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi Ashish,
Here you find good library for ZIP/UnZIP uitility.
It is just .cpp & .h files for ZIP & UnZIP utility.
This library is used in any c++ compiler (g++ linux, VC++ eVC++).
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
I am trying to cast an int pointer to double pointer, but conversion doesn´t work. I´ve tried c style casting and reinterpret_cast without success. Can anyone help me, please? For instance, how can I make ths work fine:
int a[]={1,2,3,4};
int* b;
double* c;
b=a;
c=(double*)b;
Thanks
|
|
|
|
|
Jorge wrote: how can I make ths work fine:
What does it mean, in your opinion?
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
[My articles]
|
|
|
|
|
I am not sure what you mean.
|
|
|
|
|
The code is working fine, anyway it is not performing a conversion, it is interpreting the raw bits as a double.
You have the following string of bits (only the first two ints of the array matters):
1 2
00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000010
as a double it is
00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000010
^
0 as sign (first bit on the left), i.e. positive number
00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000010
^---------^
0 as exponent with in excess -1023 representation represents denormals when fraction is <> 0
(as in your case).
00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000010
^---------------------------------------------------------^
2^-20 + 2^-51 = 9,5367431685033920985006261616945e-7 as fraction
That gives, for a denormalized number
fraction * 2^-1021 = 4,2439915839068072135877506064327e-314
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
[My articles]
|
|
|
|
|
Good stuff man, my 5.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thanks, anyway I'm quite sure there's some mistakes here and there...
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
[My articles]
|
|
|
|
|
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hmm, it seems I got my reply. I still have the problem but this makes me afford it in a wiser manner. Thanks so much.
|
|
|
|
|
What do you mean by "conversion doesn't work"? There's actually no conversion that I can see. If you were wanting to convert the individual int elements of your int array to double , you should do that 'manually'. If you were just intending to change the pointer type, then there shouldn't be any difficulty:
int nArray[] = {1, 2, 3, 4};
double* pDouble = reinterpret_cast<double*>(nArray);
CString szStr;
szStr.Format(_T("%d %d"), *pDouble, *(pDouble+1));
AfxMessageBox(szStr);
Of course, I assume that you know what reinterpret_cast does.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi,
I am just trying to get a pointer to double from a pointer to int. That is what I mean by conversion. When you say 'manually' I actually dont know what you mean. I tried your code:
int nArray[] = {1, 2, 3, 4};
double* pDouble = reinterpret_cast<double*>(nArray);
but when I try to get *(pDouble(+i)) value(s) (for i=0,1,2,3) don´t get the expected 1.0,2.0,3.0,4.0
|
|
|
|
|
Have a closer look:
1. nArray is a an array of integers - the elements stored in the array are of 'int ' data type.
2. You create a pointer variable, which actually is supposed to point to a double , but you made it (you wanted that) to point to the beginning address of the integer array.
3. Now, it's just that the pointer type is double , but is pointing to an int array. You still have not converted the individual int elements in the array to double type.
4. If that's what you want, you can try %g in place of %d in the CString::Format() statement and see the results. (this way, you are just 'interpreting' an integer as a double, and you haven't converted any of the array elements from one datatype to another)
But please remember that the elements in the array are *still* int ones and if you want every element of the array to be of double data type, you must do the conversion yourself for every element of the array. Changing a pointer won't do that, quite obviously.
Am I clear enough?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thank you very much.You both helped me to see my real problem.
|
|
|
|
|
Hi Jorge,
Why don't you use union ?
For example you can take
union test
{
int a[4];
double c;
};
Do not trust a computer...
Always check what computer is doing
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
Hi Divyang,
thanks so much. That solves the problem but, I can not believe there´s no straight way to do it.
|
|
|
|
|
Hi ,
When i include any header file in a cpp file May i know why the syntax is #include "test.h" why not #include <test.h> .Please let me know the difference...
|
|
|
|