|
Here is a very basic solution:
<br />
void main()<br />
{<br />
vector<int> Col1, Col2;<br />
ifstream fin("mytext.txt");<br />
while (!fin.eof())<br />
{<br />
int c1, c2;<br />
fin >> c1 >> c2;<br />
Col1.push_back(c1);<br />
Col2.push_back(c2);<br />
if (fin.eof())<br />
{<br />
break;<br />
}<br />
}<br />
<br />
int Column1Total = accumulate(Col1.begin(), Col1.end(), 0, add<int>()); <br />
int Column2Total = accumulate(Col2.begin(), Col2.end(), 0, add<int>());<br />
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
I need to dynamically create 3-5 radio button on a dialog box in vc++6 using mfc.
Please can somebody help me. I am just not getting it.
Thanks,
Tara
Fortitudine Vinsinues!
|
|
|
|
|
Having you considered using the CButton::Create() method? What code do you have that is not working?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
This is what I have done:
void CBudget::CreateRadioButtons()<br />
{<br />
CButton newRadio;<br />
CRect rect;<br />
<br />
#define IDD_NEWR1 0x1234<br />
<br />
rect.bottom=150;<br />
rect.top=100;<br />
rect.left=100;<br />
rect.right=250;<br />
<br />
newRadio.Create(_T("Home"), WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_RADIOBUTTON, rect, this, IDD_NEWR1);<br />
but nothing showsup. I have called
CreateRadioButtons() in OnInitDialog()
Fortitudine Vinsinues!
|
|
|
|
|
I think you should move the CButton newRadio; declaration to the class body. Make it as a data member of CBudget . Otherwise your control is deleted after finishing the CreateRadioButtons function.
-- modified at 9:50 Thursday 22nd June, 2006
Another solution is to put your controls in the dialog using Dialog editor, making them invisible. When you need to show them, just make visible. In this way is easier to define event handlers for your controls.
|
|
|
|
|
Ah yes! It worked. Thanks.
Now, if I create 3 buttons, how do set then as a group. i.e how do I use them? How do I get which radio button has been selected.
Fortitudine Vinsinues!
|
|
|
|
|
TheinstruTara wrote: ...how do set then as a group...
Use the WS_GROUP style for the first one.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Add Handler's for them in message map section
ON_BN_CLICKED(ID_RADBUTTON ,OnRadioClicked) // Defined ID_RADBUTTON
//in the header file
afx_msg void OnRadioClicked();
//and in the cpp file
void CCheck1Dlg::OnRadioClicked(){
//Some COde
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
The problem is I do now know how many will be needed. It dependes upon how many budget entries a user makes.
Fortitudine Vinsinues!
|
|
|
|
|
Can I not create another radio button using the same CButton object, newRadio?
Fortitudine Vinsinues!
|
|
|
|
|
Yes, but newRadio will need to be a pointer.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
A CButton object is for one radio button. If you need more, define another CButton data member.
In case of variable number, you can define a dynamic collection of such objects. For instance, you can try CTypedPtrArray< CObArray, CButton * > .
You have to create new buttons with new CButton , then call Create , and then add to collection with Add . Do not forget to delete the unneded buttons with delete .
|
|
|
|
|
Oh no I just dont have the time to figure out that. I guess I use good'ol combo box or a list box instead!!
Thanks a lot for the help everybody. I will definitly try it out later, and maybe post an article;)
Fortitudine Vinsinues!
|
|
|
|
|
Move the line CButton newRadio to the header file Budget.h
What i think is that you are going to create these buttons dynamically and more than once. So it would be better for you to change the function definition to
CreateRadioButton(int,int,int,int);// Specifying where to place the buttons.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
TheinstruTara wrote: CButton newRadio;
This object has function-level scope. It needs to be a member of the CBudget class.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I created one win32 console application .I want to collect the content of console application window from another utility. when ever i want to collect content of that console window just initiating utility is enough.it will dump the content in to one text file. can any one help me to create that utility?
|
|
|
|
|
May be this can help you.
See Here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
If the utility will be spawning the console application, see here and here. Otherwise, you'll need to go this route.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello all,
By following article at http://www.codeproject.com/internet/rpcintro1.asp and http://www.codeproject.com/internet/rpcintro2.asp, I was able to have RPC feature in my application.
However, I realize that even I successfully call the RpcServerUseProtseqEp for the first time. I will have problem calling the same function, with same parameters at the second time, after I close all the RPC resource using RpcMgmtStopServerListening. I will get the following error result:
RpcServerUseProtseqEp failed. The endpoint is a duplicate. (1740)
The sequence of my RPC server is as follow, RpcServerUseProtseqEp-> RpcServerRegisterIf-> RpcServerListen (In another thread)-> RpcMgmtStopServerListening-> RpcServerUseProtseqEp (Opps! Fail at here)
Any idea on how I can restart the RPC service after I end it?
Thank you
yccheok
|
|
|
|
|
Hai I have a project which need to be build in win32 console, But I have build it in win32application. is there any small modification helps me to change the project win32 app to console instead doing all again.
Thanks in advance.
Krishna
|
|
|
|
|
AFAIK the interface used by the two types is all together different with very little similarities being shared between them.It would be easier for you to put your code again in console based application.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Any classes you have that are not related to User Interface should be reusable.
|
|
|
|
|
In your compiler options, remove the _WINDOWS preprocessor symbol and change it to _CONSOLE
In your linker options, change /subsystem:windows to /subsystem:console
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
VB > soccer
|
|
|
|
|
Hello comunity,
is there any function to read all contentens from an CTreeCtrl object, in order wich ist showed?
Mean like this:
Root
-Item1
-Item2
-Item3
--Child1
--Child2
--Child3
---Child_a
---Child_b
---Child_c
-Item4
....
-Item_n
in this order to print out or stored in an file!
i make my own but i cant read in the order like this sample
thanx
break;
|
|
|
|
|
You have to use GetNextItem(TVGN_CHILD) / GetNextItem(TVGN_NEXT) in a recursive function to iterate through all items. Start at TVI_ROOT.
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|