|
Hi all.
I want to add number of strings in a list box plus a check box infront of each string.
How I can do this?
Thanks
Rakesh Thakur
|
|
|
|
|
Use CListCtrl instead and then call CListCtrl::SetExtendedStyle(LVS_EX_CHECKBOXES)
Hope this helps
|
|
|
|
|
use CCheckListBox class
nave
|
|
|
|
|
Did you search on codeproject I think I saw examples
|
|
|
|
|
Rakesh_Thakur wrote:
Hi all.
I want to add number of strings in a list box plus a check box infront of each string.
it is not possible in the Common CListBox class, unless and until you subclass it handle CheckBox or you can see reply by MR. BadJerry
<div class='ForumSig'>"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you </div>
|
|
|
|
|
I want to write reg value in HKLM in windows Vista. But RegOpenKeyEx() API is failing. I am using access rights as KEY_READ | KEY_WRITE. Please give some suggestion.
|
|
|
|
|
Hi,
"KEY_WRITE" -> have you administration rights? (because HKLM)
What is the return value of GetLastError()?
Frank
|
|
|
|
|
Yes, the user has administrative rights. Though the user is not the by default (in built) administrator. GetLastError is returning Access denied.
|
|
|
|
|
|
I have the following template function
<br />
typedef std::vector < void * > ARRAY_PTR;<br />
template<class T> void ClearPtrArray(ARRAY_PTR& vecVoid)<br />
{<br />
for (ARRAY_PTR::iterator itWhere = vecVoid.begin(); itWhere != vecVoid.end(); itWhere++)<br />
{<br />
T* pT = reinterpret_cast< T * >(*itWhere);<br />
delete pT;<br />
}<br />
<br />
vecVoid.clear();<br />
}<br />
This works great in VS 2005 but not in VC+6.0
I have the following code in a destructor
<br />
ClearPtrArray< askia_wave::CVersion > (m_rgVersions);<br />
ClearPtrArray<askia_wave::CQuestionClass>(m_rgQuestionClasses);<br />
ClearPtrArray<askia_wave::CLanguage>(m_rgLanguages);<br />
ClearPtrArray<askia_wave::CModality>(m_rgModalities);<br />
ClearPtrArray< askia_wave::CQuestion >(m_rgQuestions);<br />
ClearPtrArray<askia_wave::CWave>(m_rgWaves);<br />
And I get a runtime crash. With the debugger, when I look at * pT in ClearPtrArray, the type is clearly not the correct one. For instance the first member of m_rgVersions is recasted as a question (which of course causes the delete to crash) and so on...
Any idea? Of course I could derive all my objects from the same type and use a virtual destructor but that's not the point. I have heard that VC+6.0 STL implementation was bad but surely not that bad?
Thanks in advance!
-- modified at 9:16 Monday 4th December, 2006
|
|
|
|
|
Why don't you simply delete the contents of the iterator without the cast ? You don't need to cast it.
|
|
|
|
|
Because the destructors of the objects allocated in the arrays (eg CVersion) would not be called...
|
|
|
|
|
Yes they would. The content of your iterator is not a void pointer, it is a template, so the compiler knows which object it needs to destroy.
|
|
|
|
|
I do not know why - if it's a problem in the code tag or (and that would be embarrassing) I cannot do a copy and paste but
this is what I meant
<br />
typedef std::vector < void * > ARRAY_PTR;<br />
so yes the iterator content is void *
|
|
|
|
|
I see. But I still don't understand what you are trying to do.
You posted this code:
ClearPtrArray< askia_wave::CVersion > (m_rgVersions);
ClearPtrArray(m_rgQuestionClasses);
ClearPtrArray(m_rgLanguages);
ClearPtrArray(m_rgModalities);
ClearPtrArray< askia_wave::CQuestion >(m_rgQuestions);
ClearPtrArray(m_rgWaves);
Can you show the definition of m_rgVersions, m_rgQuestionClasses, m_rgLanguages, ... ?
I suppose they are all of type std::vector<void*> (I just guess, because otherwise the code won't compile I think).
But then my question: why don't you use vector in the standard way ? So, store the pointers to your class and not a simple void pointer ?
|
|
|
|
|
you are right about the declaration
<br />
ARRAY_PTR m_rgWaves;<br />
ARRAY_PTR m_rgQuestions;<br />
ARRAY_PTR m_rgQuestionClasses;<br />
ARRAY_PTR m_rgModalities;<br />
ARRAY_PTR m_rgLanguages;<br />
ARRAY_PTR m_rgVersions;<br />
yes you are right, I could use a vector like this vector < CQuestion * > m_rgQuestions but the idea was to have something like the MFC CObArray. Oh and the code is shared ( I did not write it) ... and it should work so it is a bit of a pain to rewrite a lot of code because it is used in a VC 6.0 project...
|
|
|
|
|
Hi!!
can any body tell me ,how i can create "filename.ini" file when i debug my program..ie when i debug then "Filename.ini" file automatically create in debug folder of my project (or specified path)
how i can...??
Thanking you
shah satish
|
|
|
|
|
how about
CStdioFile filReport(_T("c:\\MyDir\\MyFilw.ini"),CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
?
|
|
|
|
|
Thank you soo much for your help..
|
|
|
|
|
Hi,
<br />
CreateFile( "FullFilePath", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);<br />
e.g. with FullFilePath = "C:\\MyDir\\MyApp\\debug\\filename.ini"
or get the directory with: GetCurrentDirectory(...)
or otherwise with: GetModuleFileName(...) + _splitpath(...)
HTH
Frank
-- modified at 7:43 Monday 4th December, 2006
|
|
|
|
|
Thank you soo much for your help..
|
|
|
|
|
or you can use
<br />
CFile::Open->CFile::modeCreate | CFile::modeWrite
|
|
|
|
|
Thanks you very much for your help..
|
|
|
|
|
Shah Satish wrote: how i can create "filename.ini" file when i debug my program
In addition to what the others have indicated about creating the file. If you want to just create the file while in a debug build use
#ifdef DEBUG
...
#endif
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Shah Satish wrote:
an any body tell me ,how i can create "filename.ini" file when i debug my program..ie when i debug then "Filename.ini" file automatically create in debug folder of my project (or specified path)
how i can...??
ols C and C++ runtime function still work in VC++ like FSTREAM or fopen!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|