|
I think he ment where did the remark of AFX_INCLUDE comes from...or did i missunderstand him???
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote: I think he ment where did the remark of AFX_INCLUDE comes from...
It all depends on how you interpreted the question. Technically, AFX_INCLUDE is not a command. In any case, it is added by ClassWizard.
YaronNir wrote: ...or did i missunderstand him???
Your reply to him implied there was no understanding at all.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Hi all
i have adialog -based application.when a button is pushed a user defined function has to be called which will have to read every word from (one word in one line)notepad to the CString varaible used in my VC++6.0 program.
how can i do that
is there any built-in methods or is it necessary to use the database connection?
Thanks in advance
--lekshmi
|
|
|
|
|
not sure i undestand correctly what you mean but,
if you find the notepad window, one of its child is the rich edit control (where the words are in place) from there all you have to do is read them line by line into a CString....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote: if you find the notepad window, one of its child is the rich edit control (where the words are in place)...
I'm not sure what OS you are using, but with Windows XP, Notepad does not use a richedit control.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
"I'm not sure what OS you are using, but with Windows XP, Notepad does not use a richedit control."
my bad, it uses a Edit....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Fairly simple my friend!
What i do is that,
first of all include fstream.h and string class in your dilog's cpp file.
Now in the function associated with that button, write code like this
ifstream fin;<br />
string data;<br />
int size = 0;
char *name;
fin.open("myfile.txt");<br />
while (!fin.eof())<br />
{<br />
fin>>data;<br />
size = data.strlen();
name =(char*)malloc(size + 1); <br />
strcpy(name, data);<br />
CString myCString = CString(name);
}
I did not run this code. So if you find any problem let us know.
Good luck
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
He wanted to read data from notepad, not from a file.
An advice also:
fin>>data;
size = data.strlen();
name =(char*)malloc(size + 1);
streams (ifstream for example) are part of C++ and malloc is more a C programming style. In general, it is not really nice to mix C and C++ in this way. But this is just a detail .
|
|
|
|
|
hello,
thank you for the sudden response.
i know this is now mixing of C And C++.but how can i eliminate the problem.plz help me
thanks in advance
lekshmi
lekshmi
|
|
|
|
|
You've not been clear with your questions right from the beginning. Now what do you want to eliminate? You use VC++, but you don't wanna use C++, you want C rather? Anyway, If you want one from MFC, you can have a look at this.
<br />
CFile cf;<br />
cf.Open("c:\\test.txt",CFile::modeCreate|CFile::modeWrite);<br />
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
Sorry, I don't know the answer. I was just answering to another post.
|
|
|
|
|
Yes it is but i dont know any other way to do it. I think if it works, do it. Can you please tell me what could be the problems when we mix c and c++?
Thank you
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Aqueel wrote: Yes it is but i dont know any other way to do it
Use new instead of malloc:
name = new char[size + 1];
For char arrays, there is no difference but if you use arrays of classes, then definitively you should use new instead of malloc. malloc will only allocate the memory and when you release it, it will just free the memory. With new and delete, the constructor and destructor of your class will be called which allows you to put some initialization and some clean-up code in your object. This is a much more object-oriented way of working.
Aqueel wrote: Can you please tell me what could be the problems when we mix c and c++?
There won't be any problems (or at least not that I'm aware of). It is more to have your code to be consistent. That's why I said it wan't very important .
|
|
|
|
|
Thank you Cedric!
I got it...
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
hi
Aqueel's code really works for me.but it is a mixing of both c and C++
how can i remove this.
i am using VC++6.0.is there a similar methods available in VC++
thanks in advance.
lekshmi
|
|
|
|
|
what do you want?
Menu:
1.Read A Text File.
2.Read The Text Content Of A NotePad.
3.Not Sure.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
hello
i want to read the text content of a notepad
|
|
|
|
|
I tried with ::GetWindowText() with the help of Spy++ , but I could find Nothing visible. I'll try it again when I have enough time. But you'll certainly have a better answer from better coders here.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
I don't know the answer but maybe I can help you to find another solution. What do you want to achieve exactly by reading the contents of notepad (this looks like a really strange idea and probably bad design). Please explain that as clearly as possible (not just "because I want to read that into my variables").
lekshmipriya wrote: is it necessary to use the database connection?
No notepad is not a database so this won't work at all.
|
|
|
|
|
I have a program (demo.exe) that I want get it in my web site and any one who down load it and unzip it in the computer , this program can run correctly even visual studio didn't install on that computer .
|
|
|
|
|
Please clearly explain your question.
Now i dont know what you actually want to do.
If you want your program to run on computers that do not have Visual studio installed on them, follow following instructions.
If you are using MS VC 6.0,
1 Open your project in MS VC++ compiler.
2. Go to Project and then Settings
3. Select Genral tab, Under Microsoft Foundation Class, select
Use MFC in a Static Library
4. Recompile your project.
Good luck
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Aqueel wrote: 3. Select Genral tab, Under Microsoft Foundation Class, select
Use MFC in a Static Library
No mention was made of MFC.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Well, in fact you didn't mention much.
I'll assume that what you want is:
1) Install the application in the web server
2) Make it possible for people to download it
3) Make it so people can run your application on their environment
To install the application in your web server you shouldn't need any special conditions. But, in fact, you don't say much about this. Do you host your web site? Did you make the site (HTML pages)?
Then, after clarifying what you want to do about point 1), you need to determine how people can reach your application. Installing the "demo.exe" file on a web page is not difficult, and if the users click on the link they will, typically, see a dialog box asking them if they want to execute or download the file.
If this were true for all people then point 2) above was not necessary, since the solution would be trivial. But the most recent operating systems have all kinds of firewalls and protection mechanisms that block executables, or make it much more difficult for people to download and execute them. Some antivirus programs that the user may have installed make it even more difficult to download your "demo.exe" and run it.
So, you may consider several options for your "demo.exe". The simplest one could be to wrap your application in a ZIP file, since these files are much more accessible. So, people would download "demo.zip", open it, and execute it. Although this makes it easier to get through some protections it is not full proof, and the user must have the ZIP (or UnZip) application installed on their system.
And there is also the corporate users. Anyone trying to download your application from within the company where they work will probably be blocked, even if you put the application inside a ZIP file. This will depend on the security policies of the company, and how strongly they enforce them.
Number 3) above concerns the client-side requirements. If you compile your application as "Release" then most Windows users can run your application, since all Windows contain most Release DLL's. If you distribute your program in Debug then the users may run into problems, since Debug DLL's are not, typically, included in Windows installations.
The above statement is not true for any .NET code. This code requires a virtual machine of about 22 MB to be installed in the client. Not all Windows installations have this, especially those before Windows XP. I'm not sure which have it and which do not, but you can google for this information. However, the statement is true for MFC applications, so you don't need to statically link. Your application is not MFC? Feel free to ignore the previous sentences...
Then, there is the problem of compatibility with very old operating systems, like Windows 95. This, of course, depends on the features your applications uses. For a simple dialog based GUI with some buttons you should be fine.
So, as you can see, your post provides very little (or no) information for a topic that is relativelly complex. You may want to ellaborate a little bit. Please take into account that downloading executables is considered to be the most dangerous way of spreading viruses, and people are becoming much more aware to that. I would, probably, not download your executable simple because it is an executable.
To get applications to run on the client machine after being downloaded from the WEB you should consider JAVA. It is not a hard language to learn, and it is considered much safer than executable binaries. So, the download and execution process become very simple.
|
|
|
|
|
Rilhas wrote: Well, in fact you didn't mention much.
You're right, other than my asking aquaal why he suggested statically linking with MFC even though akram made no mention of using MFC.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Oh David! I am Aqueel, not Aquaal
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|