|
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
|
|
|
|
|
|
|
Hi,
I want to define preprocessor constants in command line.
In source it would be something like this:
#define STR_SOMETHING "something"
Now how can I get the same result in command line using /D?
I tried in VS 2005, in Project Property Pages->Configuration Properties-> C/C++->Preprocessor-> Preprocessor Definitions…
Adding STR_SOMETHING=”something” doesn’t work. In Command line it looks like this:
/D "SOMETHING="something"".
The problem is with "".
Any idea how to do this?
|
|
|
|
|
forget what i said...
-- modified at 8:02 Monday 7th May, 2007
|
|
|
|
|
Are you sure? On my system (VS 2003) It doesn't work. Moreover (excerpt from MSDN):
"With one exception, defining symbols and constants with this option has the same effect as using a #define preprocessor directive at the beginning of your source file. If you use /D, quotes on the command line will be stripped whereas they are retained in a #define statement."
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.
|
|
|
|
|
when string starts with digits, it try to parse it to number
when with charackter... identyfier
|
|
|
|
|
HI
I HANE A PROBLEM IN CONNECTION OF MYSQL TO VC++(MFC)
LINK : fatal error LNK1104: cannot open file "C:\Program.obj"
Error executing link.exe.
PLEASE GIVE ME A HINT
THANKS
hi
|
|
|
|
|
NO NEED TO SHOUT !
and isn't the error message descriptive enough ?
the linker says he doesn't find the file C:\Program.obj...
does your compiler really generate this file ?
don't you have a problem of path name ?
see both your compiler and linker settings to find which one is badly configurated
|
|
|
|