|
I can't see anything wrong with your code. Perhaps attach crash details. I suspect the problem is not in the code you posted but somewhere "in between". For example - maybe the element is removed from the list somewhere.
Steve
|
|
|
|
|
Thank you Steve and Chris. You're right Steve, this code is ok. I've spotted the problem in a different place and now it works fine. Thanks for support mates!
|
|
|
|
|
Hi, I have a solution with some projects that produce dlls. However some of these projects also generate a .lib file for their respective dll in order for another project to link with dll at linking-time. However some other dll projects do not provide me a .lib file. Why does this happen?
At first I thought I missed an option at the property page of the latter projects but this is not the case, as I compared the property pages finding no such differences.
What should I do in order for all my dll projects provide me with a lib file?
Thank you.
PS - I'm using VS2005
|
|
|
|
|
Typically, this means that you are not exporting anything from the DLL. Is that the case?
Regards,
Nish
|
|
|
|
|
Yeap actually that was the case, I forgot to export the symbols. Thanks for the tip, I could have gone days without realizing it.
|
|
|
|
|
Hi,
I attach an image list to the CHeaderCtrl with a call to CHeaderCtrl::SetImageList.
Later I use CListCtrl::SetImageList to attach an image list to the CListCtrl object used for the items.
The 2 image lists are different. Every time I call CListCtrl::SetImageList my image list of the
header control gets overwritten with that of the list control.
Is this a bug ?? or is it impossible to maintain 2 different image lists.
Thx
|
|
|
|
|
|
I have installed an OnSetImageList message handler for the header control. THis one gets called when an image list is installed for the header control and it gets called a second time when the CListctrl object is assigned his image list. To install the image list of the header control I do the following call from within the OnCreate message handler of a derived CListCtrl Object (CXListCtrl) :
m_HdCtrl.SetImageList(&m_ilSymb);
m_HdCtrl has been subclassed to the Header control.
To install the image list of the CListCtrl object itself I do the following call in the OnCreate handler of a CXListCtrl derived class. (CPCntCtrl)
SetImageList(&m_ilCntSymb, LVSIL_SMALL);
Can someone tell me please what is going on here ?
Thx
|
|
|
|
|
I have a List control where sometimes I want to limit it to a single selection and other times to multiple selections.
You choose the Single Selection parameter at design time, but I'm sure there must be a way to change in on the fly. It is most like a SENDMESSAGE, but what is the message I need to send?
Thanks,
Ilan
|
|
|
|
|
hi ,
Try SetWindowLong Function .
Regards
FarPointer.
|
|
|
|
|
Hi Ilan,
the following will result in a single-selection list:
m_myList.ModifyStyle(0, LVS_SINGLESEL);
this one will result in a multi-selection list:
m_myList.ModifyStyle(LVS_SINGLESEL, 0);
first parameter removes the passed style, second parameter adds the passed style.
Regards, mykel
If they give you lined paper, write the other way!
|
|
|
|
|
Hi Mykel,
This is EXACTLY what I was looking for! It solves the problem.
Thank you very much,
Ilan
|
|
|
|
|
int main()
{
int *ptr[2];
if(ptr[0] = null)
{
cout<<"this is empty"<
|
|
|
|
|
it is related to compiler.
E.g.
int i; //or a pointer
the value of i may be initialized as zero by some compiler, but not all.
good habit is that you initialize them yourself.
u can change code as:
===========================
int main()
{
int *ptr[2];
//====== initialize all to null
int i,iNum=sizeof(ptr)/sizeof(ptr[0]);
for(i=0;i<iNum;i++) ptr[i]=0;
//====== end enitilization
if(ptr[0] = null)
{
cout<<"this is empty"<<endl;
}
<hr style="margin ; width:405; text-align: left;">A nice <b><a style="text-decoration: underline;" href="http://www.syncedit.com/software/hypercare/" target="_new">tool</a></b> for optimizing your Microsoft <font color="#ff0000">html-help</font> contents.
Includeh10
-- modified at 9:41 Sunday 15th January, 2006
|
|
|
|
|
In addition to previous comment also change:
if(ptr[0] = null)
to:
if(ptr[0] == null):->
Michel Wassink
We must make user friendly software. Where are friendly users?
|
|
|
|
|
1. In a debug compile, the ptr[] array will be initialized to zero's. In a release compile, it will be random data. As a rule, always initialize your data.
2. if (ptr[0] = NULL) does an assignment inside an if , which is not good practice.
int main()
{
int *ptr[2];
for (int i = 0; i < 2; i++) {
ptr[i] = NULL;
}
if (ptr[0] == NULL) {
cout << "this is empty" << endl;
}
}
Software Zen: delete this;
|
|
|
|
|
Try this :-
int* ptr[2]={0};
cout << ptr[0] << endl;
cout << ptr[1] << endl;
Regards,
Nish
|
|
|
|
|
if u can use the class
CPtrArray
it has a construtor
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
#include<iostream>
#include<string>
using namespace std;
int mian()
{
string input;
char *driver;
cout<<"please input the drivers name :";
cin>>input;
cin.ignore();
driver = new char[strlen(input)+1];
return 0;
}
how come this dont work?
i am just trying to find the strlenght of input pls help me find and solve this
|
|
|
|
|
why do not add
cout<<strlen(input);
to see="" its="" length?
=""
<hr="" style="margin ; width:405; text-align: left;">A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Try :
string input;
char *driver;
cout << "Please input the driver's name : ";
cin >> input;
driver = new char[input.length() + 1];
strcpy(driver, input.c_str());
driver[input.length()] = 0;
cout << driver << endl;
Regards,
Nish
|
|
|
|
|
i tryed it and it works thanks and i understand it too
but i wanna know wht do i need this?
driver[input.length()] = 0;
y shld assigh to 0??
|
|
|
|
|
neodeaths wrote: i tryed it and it works thanks and i understand it too
but i wanna know wht do i need this?
driver[input.length()] = 0;
y shld assigh to 0??
C/C++ strings are considered to be 0-terminated. If you don't terminate your string with a 0, any function that expects a 0-terminated string would run into issues.
Regards,
Nish
|
|
|
|
|
Nishant Sivakumar wrote: C/C++ strings are considered to be 0-terminated. If you don't terminate your string with a 0, any function that expects a 0-terminated string would run into issues.
Yes, but strcpy also copies the teminating '\0'.
|
|
|
|
|
Roland Pibinger wrote: Yes, but strcpy also copies the teminating '\0'.
Yeah
What was I smoking, eh?
Thanks.
Regards,
Nish
|
|
|
|