|
Rajkumar_R wrote: class I { } const *m;
operator const I* &() {
printf("const I* typecast operator & \n");
return m;
}
My modification below.
class O
{
public:
class I
{} const* m;
O() : m(new I()) {}
operator const I* &() {
printf("operator const I* & \n");
return m;
}
};
void main()
{
O v;
const O::I* &p = v;
const O::I* &q = (const O::I* & )v;
}
Maxwell Chen
|
|
|
|
|
So now you can compile without error
|
|
|
|
|
Rajkumar_R wrote: So now you can compile without error
Yes!
Maxwell Chen
|
|
|
|
|
Hi Experts,
I want to add my command at the right click of file and folder. So I have to make some changes in registry entry. Could anyone tell what steps to follow?
I do not have any idea of shell menu.
Regards.
Pther
|
|
|
|
|
pther wrote: I do not have any idea of shell menu.
Then doing a search for tutorials on shell extensions would be a good idea...
Look under desktop development, shell and ie programming, beginners for a good start.
(I'm not being unhelpful - everything I know about shell extensions came from Michael Dunn)
Iain.
|
|
|
|
|
Hello Friends,
I need to do some checking when user clicks turnoff windows.
I am trying to capture windows shutdown event in my Win32 Console Applicaton.
In MFC application WM_ENDSESSION work well upto some extent but Win32 Application doesn't provide that message handler.
Please give some suggestions.
Waiting for the reply
abhi
|
|
|
|
|
SetWindowsHookEx to hook WM_ENDSESSION or WM_QUERYENDSESSION ?
Maxwell Chen
|
|
|
|
|
But SetwindowHook creates problem in terms of performance and extra load of dll will be there.
Is there any other way.
abhi
|
|
|
|
|
AbhijitAkude wrote: Win32 Application doesn't provide that message handler
What do you mean by that?
The message is handled like any other window message.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Create a hidden window and handle the WM_ENDSESSION message.
Steve
|
|
|
|
|
Hi all,
I've a problem in ListView management. The problem is the following:
when the ListView looses the focus, the currently selected item in the
ListView looses the selection: the selection in the ListView is not mantained
switching from a control to another in the user interface.
How can I solve this problem ? I'd like to let the ListView to mantain
the selection.
Thanks a lot !
|
|
|
|
|
Have a look in the styles. I'm pretty sure there's one called "show selection always".
Just peeked... LVS_SHOWSELALWAYS exists.
Iain.
|
|
|
|
|
|
Hi all,
I have to make a library to convert the Color from Lab value to RGB value. However, I have no much idea on the calculations or algorithms.
Suppose I will receive a data (Char pointer) then convert to RGB.
Can some of you give me some hints or examples? Please Please...
I believed that this should be easy for some experts.
Thanks for your help..
|
|
|
|
|
azusakt wrote: I have no much idea on the calculations or algorithms.
You don't have much idea or you have absolutely no idea? Tell us what you've tried.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Actually, I'm a beginner in writting Graphic related program. especially in C++.
I have no idea on the calculation for processing & converting the LAB to RGB. So I hope to find some examples with codings that I can easily to learn and understand .
Could you provide me some program examples if you have this experience.
Thanks a lot.
modified on Tuesday, January 29, 2008 10:04:23 PM
|
|
|
|
|
azusakt wrote: I have to make a library to convert the Color from Lab value to RGB value. However, I have no much idea on the calculations or algorithms.
But documentation exists http://en.wikipedia.org/wiki/Lab_color_space#Advantages_of_Lab[^].
There is also the very nice Guillaume Leparmentier's article [^] here at CP .
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.
[my articles]
|
|
|
|
|
I guess, by using an array structure you can do this. For Example:
<br />
static COLORREF arColors[] = {<br />
RGB(0,255,0),<br />
RGB(0,255,255)<br />
};<br />
<br />
char* arNames[] = {<br />
"green",<br />
"cyan"<br />
};<br />
<br />
for(int i=0; i<2; i++)<br />
{<br />
arColors[i] = i;
arNames[i] = atof(i);<br />
}<br />
modified on Wednesday, January 30, 2008 4:09:09 AM
|
|
|
|
|
Thanks for you reply.
Can you provide me a sample code for converting Lab value to RGB value?
I've read some documents, they said the step should
1. convert Lab -> XYZ
2. convert XYZ -> RGB
I don't know how to write such calculations.
|
|
|
|
|
This is a constant RGB macros of the COLORREF structure. Anyway, from 0 to 255 numeric values are equivalence a 24-Bit COLORREF's scope. If you want to chance only RGB macros, you can use the
typedef struct tagCOLORREF structure.
Forexample:
<br />
#define XYZ(int i1, int i2, int i3) 0<br />
<br />
int* pNewInt = new int[255];<br />
pNewInt = NULL;<br />
#ifdef COLORREF<br />
for(int i=0; i<255; i++)<br />
{<br />
RGB(pNewInt[i],pNewInt[i],pNewInt[i]) = XYZ(pNewInt[i],pNewInt[i],pNewInt[i]);<br />
}<br />
delete []pNewInt;<br />
#endif
That is must be a defined tagpoint struct what own yourself.
modified on Thursday, January 31, 2008 6:05:14 AM
|
|
|
|
|
Dear friends,
I am opening the selected printer's document property dialog from my application.
I am using the following code
PRINTER_DEFAULTS PrinterDef = {NULL, NULL, PRINTER_ALL_ACCESS};
HANDLE hPrinter;
PDEVMODEW pDevmode = NULL;
if(OpenPrinter(PRINTER_NAME, &hPrinter, &PrinterDef))
{
int nSize = DocumentProperties(this->m_hWnd, hPrinter,
PRINTER_NAME, NULL, NULL, 0);
pDevmode = (PDEVMODEW)LocalAlloc(LPTR, nSize);
DocumentProperties(this->m_hWnd, hPrinter, PRINTER_NAME,
pDevmode, NULL, DM_IN_PROMPT );
ClosePrinter(hPrinter);
}
Now I want to cature the paper size changes made by the user on document property dialog.
Please Help.
Sandip
|
|
|
|
|
Check out these two code paths:
float s = 1.0f + pow(2.0f,-8.0f) + pow(2.0f,-18.0f);
float fRes1 = 1024 * s;
float fRes2 = 0.0f;
for(int i=0; i<1024; ++i)
fRes2 +=s;
now watch the results:
fRes1: 1028.0039
fRes2: 1028.0002
This was tested on Intel Dual-core, VS2005. the direct multiplication was compiled to use fmul, the accumulation was compiled to use fadd. The scalar value s was crafted to know analytically which is the correct result. it is fRes1 (the fmul result).
Can anyone shed some light on the source of the difference??
it can't be (i think) a direct precision issue - all arguments and intermediate values are *exactly* representable in single precision.
any insight would be greatly appreciated!
-Ofek
modified 23-Jan-21 21:03pm.
|
|
|
|
|
It's of float issue. Using double instead will solve this.
Maxwell Chen
|
|
|
|
|
OfekSH wrote: it can't be (i think) a direct precision issue
I think the opposite.
OfekSH wrote: all arguments and intermediate values are *exactly* representable in single precision.
for instance, when executing s*1023 + s sum, you cannot line up the addition arguments without precision loss.
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.
[my articles]
|
|
|
|
|
I replaced all occurrences of float with double , and removed all the tail f , then the results match.
Maxwell Chen
|
|
|
|