|
Do you know CodeProject's article search engine [^], [^]?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
MsmVc wrote: How can i export List Control data into...
Where it goes is irrelevant. You get at it by using GetItem() and GetItemText() .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
i could open the file and i could get text from edit box but when i am trying to write to file, it is not getting written to file.
m_pStream is showing as NULL.
|
|
|
|
|
Can you post your code or expect someone to figure it out without seeing it?
Did you try and debug the code?
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}
int main()
{
string input;
ifstream myfile("Config\\test.txt");
getline(myfile,input);
Edit1->Text = input.c_str(); getline(myfile,input);
Edit2->Text = input.c_str();
getline(myfile,input);
Edit3->Text = input.c_str();
}
wkr,
Willem
|
|
|
|
|
wielklem wrote: myfile.close();
At this point, can you open the file via Notepad and see its contents?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
correct, you can now view or edit it
|
|
|
|
|
Ok, now that we've narrowed it down to just the code that reads, why not share with us what is not working? When you stepped through the code using the debugger, what do you see? Do the variables contain the expected results?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
by the way, this code expects the file to exist. if your file (ia test.txt or myfile.whatever-extention) doesn't exist, it can't be read.
keep that in mind.
|
|
|
|
|
I see an unexpected behaviour in your description.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I want to know how the TeamViewer can connect to a remote system which doesn't has a public ip. Can you tell me how its done?
Thank you
Saadhinchaali
|
|
|
|
|
I don't know anything about TeamViewer, but....
Probably by using intermediate "relay" servers.
Any machine that has web access at least has outgoing TCP/IP
connectivity using the HTTP protocol.
If both ends can get to the web, they can connect to the relay server,
which will forward (or "relay") data on to the other end.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
TeamViewer is tool using which one computer can connectct to any other computer over internet which has TeamViewer installed in it.
When we install TeamViewer it genrates a userid and password, which can be used to connect our computer from any other TeamViewer installed computer on the internet.
I wonder how it does this?
Saadhinchaali
modified on Wednesday, November 12, 2008 4:55 AM
|
|
|
|
|
Saadhinchaali wrote: I wonder how it does this?
How does it do what? I already explained how the two ends
are able to connect.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
Thank you for your answer.
My doubt is when we generate a remote desktop connection request is generated from on system how the relay server knows, to which this connection request has to be sent?
Saadhinchaali
|
|
|
|
|
Some kind of connection has to be made at both ends.
It can be done peer-to-peer as well, but that can require network
settings. The old PCAnywhere did that.
I can only guess as I haven't used it, but I know it's not magic - there's
some kind of discovery going on...
Do you have a specific question about it? Internet connections pretty much all
work the same way - a listening "server" and an endpoint requesting a connection.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hello,
it's kind of a newbie question, but i couldn't find it anyware so;
from an edit box i create a number if buttons, by pushing the "create" button.
that works without a problem.
now i want the button i just created to change colour or disapear when i click on it.
or i want an other button to disapear (ia with a textbox to filin witch one to disapear)
and that part just won work.
the number of buttons i want to create is unlimmited (1000 in this code).
what can i do?
#include <vcl.h>
#pragma hdrstop
using namespace std;
#include "Unit1.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
TButton *Button[1000];
int count;
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Button[count] = new TButton(this);
Button[count]->Parent=Form1;
Button[count]->Visible=true;
Button[count]->Top=(count*20)+10;
Button[count]->Left=10;
Button[count]->Caption= "Button "+IntToStr(count);
}
void __fastcall TForm1::Edit1Change(TObject *Sender)
{
count = StrToInt(Edit1->Text);
}
by the way, i'm using borland c++builder
wkr,
Willem
the final code wil be somthing like this:
ifstream SOSfile("config\\sos.cfg");
int ButtonCounter = 1 ;
while(NumberOfSource !=0)
{
getline(SOSfile,input);
SOButtonID = input.c_str();
getline(SOSfile,input);
SOLEFT = StrToInt(input.c_str());
getline(SOSfile,input);
SOTOP = StrToInt(input.c_str());
getline(SOSfile,input);
SOImage = input.c_str();
getline(SOSfile,input);
SOPAGE = StrToInt(input.c_str());
getline(SOSfile,input);
SOCaption = input.c_str();
getline(SOSfile,input);
SOSource = input.c_str();
getline(SOSfile,input);
SOSpare = input.c_str();
getline(SOSfile,input);
SOSpare = input.c_str();
getline(SOSfile,input);
SOSpare = input.c_str();
BitBtn[SOIDButton]=new TBitBtn(this);
BitBtn[SOIDButton]->Name= SOButtonID.c_str();
BitBtn[SOIDButton]->Visible=true;
BitBtn[SOIDButton]->Height = 57;
BitBtn[SOIDButton]->Width = 57;
BitBtn[SOIDButton]->Top=SOTOP;
BitBtn[SOIDButton]->Left= SOLEFT;
BitBtn[SOIDButton]->Bitmap->LoadFromFile(SOImage.c_str());
BitBtn[SOIDButton]->Caption = BitBtn[SOIDButton]->Name;
if(ButtonCounter <= 18){BitBtn[SOIDButton]->Parent = PanelSO1;}
if(ButtonCounter > 18 && ButtonCounter <= 36){BitBtn[SOIDButton]->Parent = PanelSO2;}
if(ButtonCounter > 36 && ButtonCounter <= 54){BitBtn[SOIDButton]->Parent = PanelSO3;}
if(ButtonCounter > 54 && ButtonCounter <= 64){BitBtn[SOIDButton]->Parent = PanelSO2;}
ButtonCounter = ButtonCounter + 1;
NumberOfSource = NumberOfSource - 1;
}
i just want these new created buttons to do something unique (read from the file)
|
|
|
|
|
wielklem wrote: or i want an other button to disapear (ia with a textbox to filin witch one to disapear)
and that part just won work.
Are you calling ShowWindow(hButton, SW_HIDE) ?
wielklem wrote: i just want these new created buttons to do something unique (read from the file)
Do you have code in place to respond to a button click?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
<quote>
Are you calling ShowWindow(hButton, SW_HIDE)?
no, in cBuilder it's Button[idbutton]->visible = false; or colour = red ia
but the problem is the [idbutton] outside the creation void this id doesn't exist.
ia:
void blabla()
{
Button[test] = new TButton(this); \\ now i've got a button called Buttontest
}
void blabla2()
{
Buttontest->colour = red; // now it should change to red
}
instead of changing the colour to red the compiler shouts out "error, this Buttontest doesn't exist"
if i put the change colour into the creation void, than it doesn't change but becomes the defauld property of the button.
<quote>
Do you have code in place to respond to a button click?
that's the problem, i don't know how to do that [newbie]
|
|
|
|
|
wielklem wrote: no, in cBuilder...
Keep in mind that this is a Microsoft-centric forum, hence the VC++/MFC at the top.
wielklem wrote: that's the problem, i don't know how to do that [newbie]
And likely neither do we, unless you happen to find someone else that knows cBuilder.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
i know, but the basics are the same, it's still c++.
if i've got the code or the basic way to work in visual c, than i can translate it into cbuilder.
creating a new button or changing a code-written button is no problem.
so what i need is the basic way to give a new-made button a function or change it's behaviour / apearence.
|
|
|
|
|
wielklem wrote: i know, but the basics are the same, it's still c++.
Not really, but that's an altogether different discussion.
wielklem wrote: so what i need is the basic way to give a new-made button a function or change it's behaviour / apearence.
Check out ModifyStyle() and SetWindowLong() .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Why so many questions, David? How is this guy supposed to get any work done when he has to spend half his day answering questions. At this rate, he'll never get around to using the debugger or reading any documentation.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Touche.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Excellent link!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|