|
Make the _MBCS -> UNICODE change as mentioned, but for an executable, you will also need to change the entry point to wWinMainCRTStartup (Project | Settings -> Link tab)
|
|
|
|
|
Hello,
like in title described i have this problem!
That because, if i click in my CListCtrl i try to find what is the text in this cell!
I do it now like this:
LPNMLISTVIEW lpItem = (LPNMLISTVIEW)pNMHDR;
LVITEM lvItem;
lvItem.mask = LVIF_TEXT;
lvItem.iItem = lpItem->iItem;
lvItem.iSubItem = lpItem->iSubItem;
this->m_cListAll.GetItem(&lvItem);
CString csItemText;
CString csIndex;
csIndex = m_cListAll.GetItemText(lpItem->iItem, 0);
csItemText= m_cListAll.GetItemText(lpItem->iItem, 1);
Thanks for Help!
termal
|
|
|
|
|
termal wrote: // this works(but why not the sample above with LVITEM?):
Try this and see what happens
LVITEM lvItem = {0};<br />
led mike
|
|
|
|
|
Hi,
thanks for answer, but this dont woks!
regards
termal
|
|
|
|
|
When you debug that code what is the value of lpItem->iSubItem ?
led mike
|
|
|
|
|
Why not use the code that works? If you're using MFC, let MFC do the work.
You can also trace into the working code and see how it differs from your code.
Back to your broken code...
The docs for LVM_GETITEM state:
"If the LVIF_TEXT flag is set in the mask member of the LVITEM structure,
the pszText member must point to a valid buffer and the cchTextMax member
must be set to the number of characters in that buffer. Applications should
not assume that the text will necessarily be placed in the specified buffer.
The control may instead change the pszText member of the structure to point
to the new text rather than place it in the buffer."
How much of that have you implemented correctly?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
you r in right, i have it now!
Thenks for Help!
termal
|
|
|
|
|
Why didn't you initialize lvItem.pszText (with a valid buffer) and lvItem.cchTextMax (with the relative size)?
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]
|
|
|
|
|
Hi,
*shame* i never use LVITEM to retrive some data, only to store to list!
But now i know how to use in both ways!
regards
termal
|
|
|
|
|
Don't bother, it's a bit tricky, indeed.
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]
|
|
|
|
|
Hello,
I am using GetProfileString to read from registry, the registry keys are created via setup and i should check if there is an option set, and the program should act accordingly.
For example;
MyApplication
Data
Data01
I have to check if Data01 available, if yes then read its setting from the registry, otherwise do the default handling.
However when i check if Data01 available, GetProfileString creates that entry for me , if that entry is there no problem but if it is not, then it automatically creates. You can see how i am trying to check.
CString category(_T("Data\\"));
category+=dataCode;
path = GetProfileString(category,_T("InitPath"));
How should i check if an entry there using GetProfileString or how can i do it?
Thanks in advance.
Bekir.
|
|
|
|
|
beko wrote: How should i check if an entry there using GetProfileString or how can i do it?
Use RegQueryValue() for the registry.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
See 'Checking Existence of Keys and Values' in this[^] article.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hello?
Is there any way to convert:
char* to const char*
const char* to char*
string to const string
const string to string
thanks in advance
It is never late to learn
|
|
|
|
|
Could you be more specific? Please post the relevant code.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Yes.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
People really don't like good answers.
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 was feeling generous. You know, I'm all for helping folks out of a jam, and even going the extra mile on occasion, but there comes a point when these posters have to grow up and start getting a clue. This next generation of developers is scaring me!
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Well, univoters are even worse: IMHO your answer is brilliant because
(1) it is actually true.
(2) enlights the inconsistency of the question.
Univoting people cannot appreciate the above.
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]
|
|
|
|
|
Cant you just type cast??
Regards,
Sandip.
|
|
|
|
|
I think what you're looking for is const_cast e.g.
char* pszData = "Letters and stuff.";
const char* pszFixedText = const_cast< const char* >( pszData );
char* pszModifiable = const_cast< char* >( pszFixedText );
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
You don't need a cast to go from T* to const T* . And please don't suggest a cast for going from const T* to T* without knowing what the OP is actually doing. Teaching new C++ programmers that casts solve everything is really detrimental.
|
|
|
|
|
Indeed, I didn't say this was good or recommended only that it was what he was looking for. In fact I'm no fan of the way const-ness is implemented in C++ at all and I don't take it nearly to the 'religious' extremes that some people do. I'd also prefer it if all type casts had to be explicitly implemented, even for builtin types but that's another issue.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Hello everyone,
I have used Generate Preprocessed File feature of VC to dump preprocessed information, my confusion is about how to read .i file, how do we treat/read the lines begin with "#line"? My confusion is for such output, typedef size_t rsize_t is surrounded by 5 #line statements. How to read them? I am really confused.
#line 470 "d:\\program files\\microsoft visual studio 9.0\\vc\\include\\crtdefs.h"
#line 472 "d:\\program files\\microsoft visual studio 9.0\\vc\\include\\crtdefs.h"
#line 473 "d:\\program files\\microsoft visual studio 9.0\\vc\\include\\crtdefs.h"
typedef size_t rsize_t;
#line 488 "d:\\program files\\microsoft visual studio 9.0\\vc\\include\\crtdefs.h"
#line 489 "d:\\program files\\microsoft visual studio 9.0\\vc\\include\\crtdefs.h"
#include <windows.h>
int main()
{
size_t x;
return 0;
}
thanks in advance,
George
|
|
|
|
|
George_George wrote: How to read them?
That tells you what line of that file the next statement(s) is from.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|