|
what about the method GetRValue();
so ur telling that it is impossible to get the name of the colour on the window with respective to selecting colour?
-- modified at 8:37 Wednesday 23rd August, 2006
|
|
|
|
|
ramanand_bulusu wrote: so ur telling that it is impossible to get the name of the colour on the window
There is no name, COLOURREF is a number. Imagine, there is more than 1 million color combination (make the calculation yourself: 256^256^256). And you want to have a specific name for EACH of those colors ??
What you need to display is the intensity of the three channels, there is no other way to do it if you want color info.
|
|
|
|
|
Cedric Moonen wrote: Imagine, there is more than 1 million color combination (make the calculation yourself: 256^256^256)
256^256^256 is rather bigger than a million - I think you mean 256 * 256 * 256 which is 16.7 million colours
|
|
|
|
|
Mmh, yes you are right, I mixed the two (I must be tired)
|
|
|
|
|
name of each color,its
<br />
R=Red<br />
B=Blue<br />
G=Green<br />
|
|
|
|
|
What kind of answer is that ?
|
|
|
|
|
WhiteSky wrote: name of each color,its
R=Red
B=Blue
G=Green
i have already declared the names .just see my question before.
|
|
|
|
|
I dont understand your purpose do you want for example cyna/orange/red/purple and....?
|
|
|
|
|
The colourref is code this way: the last significant byte is for red, the middle byte is for green, and so on.
So it is logical that you get these values:
Red:0x0000FF if you translate that in decimal it makes 255.
Green: 0x00FE00 equal to 65024 in decimal
Blue: 0xFE0000 equal to 16646144 in decimal
What did you expect as a result ??
|
|
|
|
|
i expected each value should be 255 onley.ok thanks for ur explanation.
now i want to display the name of that colour than that of values.what i have to do?
|
|
|
|
|
ramanand_bulusu wrote: i expected each value should be 255 onley...now i want to display the name of that colour than that of values.what i have to do?
If the red, green, and blue values are all 255, then the name of that color is white.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: If the red, green, and blue values are all 255, then the name of that color is white.
so, how could i solve my problem in order to display the name of the colour
on window
|
|
|
|
|
You have to do it yourself. As I said, there is no name associated with COLOURREF (it is just a number). If you have only Red (0x0000FF), Green (0x00FF00) and Blue (0xFF0000) you can check the color and display the name if it matches:
if (m_Colour&0x0000FF)
{
}
if (m_Colour&0x00FF00)
{
}
if (m_Colour&0xFF0000)
{
}
It's not very elegant but you requirement is... quite 'strange'
|
|
|
|
|
if( m_colour == GREEN )
{
str2 = "GREEN";
}
.. fill in the rest ..
pDC->TextOut(400,10,"COLOUR:"+str2);
|
|
|
|
|
use %ld in format function , COLORREF is long int .
regards
krishnan
If u can Dream... U can do it
|
|
|
|
|
How to initialize a variable array in a class? it should be static defined?
class{
...
char array[] = "asdhajsdjasgdj";
...
}
9ine
|
|
|
|
|
9ine wrote: How to initialize a variable array in a class?
Use member initialization list.
But in above case varaible is array, so cant use member initialization list. In constructor body you can initialize(re) it.
class A
{
int i;
char array[1];
public:
A():i(0)
{
array[0]=0;
}
};
9ine wrote: it should be static defined?
Not necessary.
|
|
|
|
|
in C++ (by opposition to C# or java), almost all the members should be initialized in the constructor. the only exception are static members, which init should be done outside of the class definition.
|
|
|
|
|
|
In general, you would initialize member variables as part of the Constructor (either in the implicit parameter list, or in the constructor). For the example you give, you may consider writing it the following way:
class MyClass
{
public:
MyClass() {}
~MyClass() {}
static const char* ms_MyString;
};
const char* MyClass::ms_MyString = "0123456789";
This gives you a single copy of the string regardless of the number of objects of this type you have. It will remain constant (that is, you can't change it), and it will remain in the same location in memory for the entire lifetime of your application.
If you need to have an array that you can change, you would initialize it in the constructor:
class MyClass
{
public:
MyClass() : m_MyString(0) {memset(m_MyOtherString, 0, 100);}
~MyClass() {}
char* m_MyString;
char m_MyOtherString[100];
};
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
The file list view doesnt change on changing the file type using CFileDialog in my applicatio.But in all other cases it works well.What will be the reason for that?
chandana
|
|
|
|
|
Can you post the string you provided as argument for the filter ?
Which OS do you have ?
chands wrote: But in all other cases it works well
What "other cases" do you mean ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
I tried the same code in a sample application,it works well there.
The problem exists in this particular application alone i think.
code:
CString szFilter = "Bitmap Files (*.bmp)|*.bmp|AVI Files(*.AVI)|*.AVI|All Files(*.*)|*.*||";
CFileDialog FileSelect( TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT| OFN_ALLOWMULTISELECT |OFN_EXPLORER , szFilter, NULL );
FileSelect.m_ofn.lpstrTitle = L"FileBrowse";
int nReturn = FileSelect.DoModal();
My Os - Winows XP
chandana
|
|
|
|
|
Whats problem with this code?
|
|
|
|
|
Just tried your code (commented out the title change to FileBrowse because it did not compile), and it works like a charm. It must be another problem. What bugs me is that I already had that problem, but cannot remember what it was...
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|