|
hi Hans,
Thanks for the help.
But LVN_COLUMNCLICK message will give the colem which was selected in the header of CListCtrl right?
i wanted to know to which cell in the row user selected.Is it posible to get information regarding that?
thnanks
sourabh
|
|
|
|
|
As I said, you can handle the NM_CLICK message. Here is some sample code:
void CXListCtrlTestDlg::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMITEMACTIVATE pNMIA = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
int nItem = -1;
int nSubItem = -1;
if (pNMIA)
{
nItem = pNMIA->iItem;
nSubItem = pNMIA->iSubItem;
}
if (nItem >= 0 && nSubItem >= 0)
{
CString strText = m_List.GetItemText(nItem, nSubItem);
Log(_T("OnClick at (%d,%d): '%s'"), nItem, nSubItem, strText);
}
*pResult = 0;
}
Best wishes,
Hans
|
|
|
|
|
Hi Hans,
Thank you very much.
It works i get the column which is clicked.
sourabh
|
|
|
|
|
I'm looking for a c/c++ solution for the following NP-completeness problem:
Write a function that gets an array of integers, its size and an integer. The function should return true if the sum of any subset of the array members is equalt to the integer. For example, if the array is 1,3,5,6 then possible sum are 4(1+3),11(5+6),9(1+3+5). If the intefger is 20 then the function returns false (no way of getting a sum higher than 15:1+3+5+6)
C Function declaration for example: bool is_subset(int* pArray,int nSize,int Sum)
MFC function declaration for example: BOOL IsSubset(const CUIntArray& Array,UINT Sum)
Thanks
|
|
|
|
|
have you already started to code something by yourself on this assignement ?
or are you a bit too lazy to expecting us to do your homework ?
also, please ask a specific question; asking for a whole job is all but what will bring you some help, because people here are not paid for helping, and get iritated by lazy questions...
|
|
|
|
|
Please look at my reply to Hans...
Thanks
|
|
|
|
|
That sounds like a neat assignment. Just out of curiosity, what grade level are you in?
BTW, there are more possible sums than what you list.
Best wishes,
Hans
|
|
|
|
|
Luckily I'm not a student. I guess that if I was I had the answer because it sounds like a school assignment. I'm a shame to admit that when I was this question was introduced to me I started to write it using a recursive function, but I got stuck because it started to be too complex. It was then that I thought there must be a simple (school) solution for this, as this is an academic riddle (just like the traveling salesman). I thought mayeb someone here has the insight...
|
|
|
|
|
Incase someone interested, here is a simple solution. I have no idea why I got stuck from the first place:
<br />
BOOL IsSum(const CUIntArray& Array,UINT Sum) const<br />
{<br />
for(int i=0;i < Array.GetSize();i++)<br />
{<br />
if(Array[i] == Sum)<br />
return TRUE;<br />
else if(Array[i] < Sum)<br />
{<br />
if(CheckSum(Array,Sum,i,Array[i]))<br />
return TRUE;<br />
}<br />
}<br />
return FALSE;<br />
}<br />
<br />
BOOL CheckSum(const CUIntArray& Array,UINT Sum,int nIndex,UINT SoFar) const<br />
{<br />
for(int i=nIndex+1;i < Array.GetSize();i++)<br />
{<br />
if((SoFar+Array[i]) == Sum)<br />
return TRUE;<br />
else if((SoFar+Array[i])<Sum)<br />
{<br />
if(CheckSum(Array,Sum,i,SoFar+Array[i]))<br />
return TRUE;<br />
}<br />
} <br />
return FALSE;<br />
}<br />
|
|
|
|
|
Hi
I have one enquiry. I am a novice in mfc. Using one listbox. In that sometimes I have less data, some times lot of data. Depending on that the scrollbar comes automatically. So my enquiry is that is there any way to know the presence of scrollbar in the listbox? If so how to do that ? Any suggession will be highly helpful.
Regardly
Sayed
Trusted
|
|
|
|
|
Use GetScrollBarInfo . Refer SCROLLBARINFO-->rgstate .
Your code would be something like this,
SCROLLBARINFO info;
GetScrollBarInfo(OBJID_VSCROLL,&info);
if (info.rgstate[0] & STATE_SYSTEM_OFFSCREEN)
{
}
Prasad
MS MVP - VC++
|
|
|
|
|
Hi,
I am trying to kill process from task manager using "End Process" in "Processes" tab. But I tried to get the handle / PID of the process that I have selected to terminat. I would like to know how to get the handle / PID of the process that I am trying to terminate.
I tried to use TerminateProcess API to handle this. But I am not able to get handle for the killing process (e.g. winword.exe).
Anything on this will help.
Thanks
SNI
jhghjghj
|
|
|
|
|
I am looking this in VC++.
jhghjghj
|
|
|
|
|
Probably, you are looking code some thing similar to posted[^] by this poster.
Prasad
MS MVP - VC++
|
|
|
|
|
SNI wrote: I am looking this in VC++.
please have a look at Process32First and Process32Next
"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
|
|
|
|
|
double GetInvestmentAmount()
{
Console::Write(L"How much money do you want to invest? ");
String^ input = Console::ReadLine();
double amount = \\ i want to convert the 'input 'into the double type
return amount;
}
how can I convert the " String ^ input" into the double type. Thanks in advance.
I've tried "safe_cast<double>(Console::ReadLine())" and " Covert.ToDouble(*input)" but it just doesn't work ==
|
|
|
|
|
use atof()
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
anshu, don't encourage bad post by answering them, please
there are enough of them these days, and especially today !
|
|
|
|
|
|
But he gave the OP an unmanaged solution!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
i saw that, but i'm assuming the OP is dumb enough not to be aware of it, so, capable of trying it, and spam the board with some "i don't understand, i doesn't work, please help, it's urgent, help meeeeeeeeeeee"
get me ?
|
|
|
|
|
toxcct wrote: and spam the board with some "i don't understand, i doesn't work, please help, it's urgent, help meeeeeeeeeeee"
I see the problem. But a crazy interop solution of some kind would be fun (not for me, for the
OP)
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
this code has nothing to do on an unmanaged forum...
ask the C++/CLI forum[^] please
|
|
|
|
|
|
double GetInvestmentAmount()
{
Console::Write(L"How much money do you want to invest? ");
String^ input = Console::ReadLine();
double amount = System::Convert::ToDouble(input);
return amount;
}
Now don't post managed c++ questions on the unmanaged C++ board or you will be tarred and
feathered!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|