|
Create customized HeaderCtrl class Say MyHeaderCtrl then create a member variable of this is in class of Listcontrol ,Then override the InsertColumn(...) there do the following code
InsertColumn(...)
{
CListCtrl::InsertColumn(...)
CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl();
if(( 0 != pHeaderCtrl ) && ( FALSE != IsWindow( pHeaderCtrl->GetSafeHwnd())))
{
HeaderCtrl.SubclassWindow( pHeaderCtrl->GetSafeHwnd()); // HeaderCtrl is the member variable of type MyHeaderCtrl
}
........
}
|
|
|
|
|
How can i get HPALLETE from CPalette Object?
Best Regards.
MJM.
|
|
|
|
|
CPalette::GetSafeHandle();
nave
|
|
|
|
|
mostafa_pasha wrote: How can i get HPALLETE from CPalette Object?
CPalette cpPalette;
HPALETTE hPalette = cpPalette;
|
|
|
|
|
I'm working on a project where the settings will be stored to and loaded from a file on disk. The registry is unsuitable since I want these settings to be distributable and easy to be modified by a user.
I have worked with INI files many times and found them to be suitable for very simple data (like the registry), also they are easy to read (by eye) and edit. However I have noticed that quite a few apps these days are using XML files. I have never used them in an app before but it looks simple enough. So I was wondering what other coders would prefer to use, especially for the type of app as described above.
|
|
|
|
|
INI files are arguably more human readable, but an XML file is able to describe things better and is less prone to typos. If someone makes a mistake with an XML config, odds are it just won't load.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Wow, "... and the medal for fastest response..."
The files I am going to create will be a set of rules for a game. Since the game would eventualy be Multiplayer, it is important to quickly be able to share the same set of rules. I'm tempted to go with XML simply because I didn't do it before.
|
|
|
|
|
Christian Graus wrote: If someone makes a mistake with an XML config, odds are it just won't load.
The same holds true for .ini files.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
What he means is that it will fail to parse. An INI file will still load, but you will get invalid data back when calling GetProfileString/Int/etc at some point.
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
|
|
|
|
|
Typically, I would use XML. I used INI before but in some case it is quite limited.
I use a nice library, it's called tinyXML[^]
|
|
|
|
|
Thanks for the link. I was tempted to go with one those here on CP, but since this one comes recommended, and it's on SourceForge (always a good sign) I will use this one.
|
|
|
|
|
I agree with Cedric XML is better
|
|
|
|
|
waldermort wrote: I was tempted to go with one those here on CP, but
are you saying that CPians are not recommandable ?
|
|
|
|
|
INI is old and outdated, but is useful for simple data (strings, integers).
XML is expensive to parse, but does offer the ability to do preliminary type-checking during the parse, as well as schema validation. This is very useful for complex data types.
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
|
|
|
|
|
how can i search from CEdit to a database ?
i have CDialog base aplication i use 3 CEdit controls .
Database : Visualfoxpro 6.0 on ODBC name : "name".(1 table , 3 columns)
all i want is to find if the txt from CEdit1 match the txt from database , and if is , the answer i need in CEdit 2 .
ex:
Database table
database type : snapshot.
----------------------------------
| names | city | country |
__________________________________
|george|london | england |
|michael|paris |france |
__________________________________
CEdit1 m_edit1
CEdit2 m_edit2
i write : "george" in m_edit1 and i need "london" in m_edit2.
i have onchange on m_edit1.
please help me !
thank you in advance !
Bravoone
|
|
|
|
|
Flaviu_2006 wrote: how can i search from CEdit to a database ?
1)Read the string from CEdit using the GetWindowText.
2) Read the entries from the database.
3) Compare both these values.
if these values match do something...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
i have try this :
CString sEdit1,sEdit2;
m_edit1.GetWindowText(sEdit1);
CDatabase_Name* pName = new CDatabase_Name();
if(sEdit1 == pName->m_name)
{
m_edit2.SetWindowText(pName->m_city);
}
yes it works but i have 260.000 records and i have to wait about 6 min. to have an answer !!!!!!
can you help me !
please an example !
Bravoone
|
|
|
|
|
See what just Christian Graus said. You can search for the string in the database that is in the edit box, Create a database query and then fire it...
Thanks...Christian. I just missed that point...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
how ? i dont have that information !
can you help me , please man !
Bravoone
|
|
|
|
|
_AnShUmAn_ wrote: 2) Read the entries from the database.
3) Compare both these values.
if these values match do something...
This would require reading all rows from the table. Yuck!
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: This would require reading all rows from the table
yeah , I very well know that. I replied back with some changes and I guess you didn't read it before posting this one...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Do not read the database and compare values in code, write a select statement for the DB that uses the string from CEdit1, so it only returns the match.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How can i write a select statement for the DB that uses the string from CEdit1 ?
please can you give an example on how can i do this ?
Bravoone
|
|
|
|
|
Do you not know how to write a select statement ? How are you using a database then ?
GEtWindowText gets you the string, then put it in a select. If you don't know any SQL, I recommend learning some, I don't see how you can write DB code without it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thanks i understand i think ... i will try now .
only need explication !
1000 thanks !
Bravoone
|
|
|
|