|
amitmistry_petlad wrote: hwndListbox
Its really bad coding convention.Thats why I assumed it as list box.
I dont see any reason why ListView_GetItemCount should not work with list view, if it contains items.
|
|
|
|
|
Dear prasad,
well i am new comer in the win32 programming so sorry for asking some stupid
questions.
ListView_GetItemCount(hwndListview);
is working but now there is problem with the fetching out string from the
listview's first 0 column.
1) for string it is not supported,
2)it might support for WCHAR but when i convert it into string its not convert into string it gives ? mark at debugging time.
code :
<br />
string Utility::ConvertWCHARToString(LPCWSTR source)<br />
{<br />
try<br />
{<br />
size_t len = wcslen(source) * sizeof(LPCWSTR);<br />
char* tempOutFile = new char[len];<br />
WideCharToMultiByte(CP_ACP,0,source,-1,tempOutFile,(int)len,NULL,NULL);<br />
@ the time of debugging<br />
string s = tempOutFile;<br />
if(tempOutFile)<br />
{<br />
delete[] tempOutFile;<br />
}<br />
return s;<br />
}<br />
catch(exception ex)<br />
{<br />
throw ex;<br />
}<br />
}<br />
<br />
3)so i have taken char buff[500],
for that it works fine, but when it convert into string(buff_input) it gives first char and terminate .
i also knew the reason for that i have remark when i had debug the code
in char buffer it show me the null(0) value after every character.
like e.g buff[0] | a
buff[1] | 0
buff[2] | b
buff[3] | 0
buff[4] | c
means @ all the odd position it gives me the null so the string will terminate
immidate after buff[1] so it shows first character only when convert into string
ListView_GetItemText(hwndListview,i,0,(LPWSTR)&buff,MAX_PATH);
std::string buff_input(buff);
which one is suitable (1),(2),(3)? give me the guide line master
-- modified at 9:19 Wednesday 27th December, 2006
|
|
|
|
|
amitmistry_petlad wrote: means @ all the odd position it gives me the null so the string will terminate
immidate after buff[1] so it shows first character only when convert into string
It is because, you are using UNICODE configuration.
amitmistry_petlad wrote: ListView_GetItemText(hwndListview,i,0,(LPWSTR)&buff,MAX_PATH);
std::string buff_input(buff);
Modify this to,
THCAR buff[MAX_PATH]={0};
ListView_GetItemText(hwndListview,i,0,(LPWSTR)&buff,MAX_PATH);
std::wstring buff_input(buff);
Remember, TCHAR becomes wchar_t for UNICODE and char for ANSI . And std::wstring you need to use for wide char string(which is case in UNICODE ), in ANSI you need to use std::string .
|
|
|
|
|
Hell All
I want some information about VC++.net that can we use all API in VC++6.0 in VC++.net. Is there any API which can not used in VC++.net but in VC++ 6.0.
Thanks and Regards
Atool
Atool
|
|
|
|
|
never say die
|
|
|
|
|
Refer this[^] link.
With higher version, their is support for new functionality.
M. Atul wrote: Is there any API which can not used in VC++.net but in VC++ 6.0.
Provided link should satisfy your query. There are some functions you use, but marked as depreceted.
|
|
|
|
|
|
I have send mail programitally using smtp...
But now i want to enhance my application
What i want to do is i want to provide authentication to smtp server...
How to do it???
|
|
|
|
|
use smtpclient class
never say die
|
|
|
|
|
hi every one
please tell me where do delete "achdata pointer" in this code ?
char* achData=new char[100];
strcpy(achData,"Hello");
<br />
for(;;)<br />
{<br />
char *ch=new char[100];<br />
<br />
strcat(ch,achData);<br />
<br />
if(ch)<br />
{<br />
delete[] ch;<br />
ch=NULL;<br />
}<br />
}<br />
<br />
if(achData)
{<br />
delete[] achData;<br />
achData=NULL;<br />
}
|
|
|
|
|
I assume this is a joke, because of the smiley face marking the problem line.
You will never get to the code that deletes "achdata" because of the infinite "for" loop.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
John R. Shaw wrote: I assume this is a joke, because of the smiley face marking the problem line.
The smiley face was unintentional - a result of for( ; ; ), with the spaces removed.
|
|
|
|
|
I should have thought of that.
Note to self: Do not answer questions before your mourning coffee.
|
|
|
|
|
John R. Shaw wrote: your mourning coffee.
There, there... dont take it to heart.
|
|
|
|
|
|
So was this a joke? If not then
this code is bad:
char *ch=new char[100];
strcat(ch,achData);
You haven't initialized ch before using strcat() on it.
You are in an endless for loop so your "if(achData)//This code will not run never" will
never get called.
|
|
|
|
|
Sorry about that....I just noticed John Shaw already answered about the endless loop.
Sorry John
|
|
|
|
|
use of Ignore HTML tags when you want to psot code
|
|
|
|
|
Im working in C++ w MFC. In my program i create a char that looks kinda like this:
char data[11] = "1101110110";
and then later in the program i have a for which reads this binary data and does certain things depending on if its a 1 or 0:
for ( short c=0; c<=10; c++ )
{
if (data[c] == 1 )
{
//do this
}
}
But it doesn't work at all, the data[c] always seems to return 0 with the if..
any ideas?
maybe theres a better way to store my binary data (which is actually a lot longer, like 64 chars) and then do things depending on 1 or 0?
thanks!
man ive gotten like loads of post errors now..
/Johannes
|
|
|
|
|
you are testing ascii values
ie.
'1' == 49
for this to work you can test
if (data[c] == 49)
or you can test
if (data[c] == '1')
Hope this helps
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
if ( 1==(int)data[c])
never say die
|
|
|
|
|
i m not able to modify my posting so a better way
int i=atoi(&data[c]);<br />
if ( 1==i)
never say die
|
|
|
|
|
Johpoke wrote: if (data[c] == 1 )
{
change this to
if (data[c] == '1' )
{
}
|
|
|
|
|
Johpoke wrote: char data[11] = "1101110110";
Are you really using
data as a chars or as numbers? You can't directly compair a number to a char.
If
data is just an array of numbers and thats all its used for why not do an array of numbers then?
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Ah yes of course thank you all!
/Johannes
|
|
|
|