-
March 24th, 2011, 12:20 AM
#1
Visual C++ MFC dialouge based application
hello Guys i am new here and also New to Visual C++
my task is to make Dialouge based application in MFC, that take text file and read it. and interfacing with hardware. i learn some thing i a, able to that. can anyone help me to tell from where i can learn these thing especially. i will very thankful to you.
-
March 24th, 2011, 12:42 AM
#2
Re: Visual C++ MFC dialouge based application
What version and what edition of Visual C++ are you using?
-
March 24th, 2011, 02:38 AM
#3
Re: Visual C++ MFC dialouge based application
-
March 24th, 2011, 04:29 AM
#4
Re: Visual C++ MFC dialouge based application
Rather than opening an acc in forum this simple thing can be found from google itself. For a starting of vc++ dialog based application see this.
◄◄ hypheni ►►
-
March 24th, 2011, 04:50 AM
#5
Re: Visual C++ MFC dialouge based application
Originally Posted by adnan86
...
my task is to make Dialouge based application in MFC, that take text file and read it. and interfacing with hardware...
Well, your first step is creating the dialog App.
The second - read text file. I'd suggest using MFC classes CString to store the text and CStdioFile to read in.
After you'll be complete these steps we'll be going on with the next task ("nterfacing with hardware" which is not clear for me yet)
Victor Nijegorodov
-
March 24th, 2011, 06:59 AM
#6
Re: Visual C++ MFC dialouge based application
First I have to write some thing in text file then read that file and load to List Box..
// This button will input the Data into the File
void Cfile1Dlg::OnClickedBtnExcute()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
fout.open("test.txt");
int temp1;
CString str;
str.Format(_T("abc"));
fout << m_Name<< m_Regno<<m_Cellno<< "\n" ;
fout.close();
UpdateData(FALSE);
}
// This buuton will take the data from file and load to Listbox.
void Cfile1Dlg::OnBnClickedOuput()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
ifstream fin;
fin.open("test.txt");
int temp1,Numb1;
//m_List1.GetItemData(m_regno);
while (!fin.eof())
{
fin >> temp1;
m_List1.GetItemData(temp1);
m_res=temp1;
}
fin.close();
UpdateData(FALSE);
}
please tell where am doing mistake because its not giving required output.
-
March 24th, 2011, 07:11 AM
#7
Re: Visual C++ MFC dialouge based application
Looks like you're just guessing. Get a good book.
Off the top of my head,
You don't need the calls to UpdateData
You're using GetItemData in a context that makes no sense. Nothing in your code would add a string to a list box.
You're setting m_res=temp1 each time through your read loop, which makes no sense.
You're using Format instead of just = to assign a string literal to a CString
As VictorN pointed out, CStdioFile makes more sense in an MFC app than streams because it will write directly to a CString and uses MFC Exceptions.
-
March 24th, 2011, 07:16 AM
#8
Re: Visual C++ MFC dialouge based application
Originally Posted by adnan86
please tell where am doing mistake because its not giving required output.
How can I tell you about the "mistake" if you didn't mention what all these identificators (like m_Name, m_Regno, m_Cellno, m_List1, m_res) mean, and what the purpose these lines
Code:
int temp1;
CString str;
str.Format(_T("abc"));
are for?
Victor Nijegorodov
-
March 24th, 2011, 07:29 AM
#9
Re: Visual C++ MFC dialouge based application
Thanks for your reply .
you are rite am really doing all my self, i am very new to this and icant find anything related to this in Google.can you help me in just tell me any book or site which helps me in doing this.
-
March 24th, 2011, 07:34 AM
#10
Re: Visual C++ MFC dialouge based application
Originally Posted by adnan86
Thanks for your reply .
you are rite am really doing all my self, i am very new to this and icant find anything related to this in Google.can you help me in just tell me any book or site which helps me in doing this.
I'm not up on all the latest books, but go to any good book store that has a programming section. There should be several beginners books aimed at Visual Studio 2010 and MFC apps. There's way too much to learn to try to figure it out on your own. I wouldn't even try Google for programming lessons. Most books are over 1,000 pages long for a reason. They'll guide you step by step on what you need to know.
-
March 24th, 2011, 07:59 AM
#11
Re: Visual C++ MFC dialouge based application
Thanks. But may be i didnt find it correctly but am doing my best to find some books relted to that.. but i didnt.
if any one of you know any material which help me.i will be very very Thankful to him
-
March 24th, 2011, 08:04 AM
#12
Re: Visual C++ MFC dialouge based application
Originally Posted by adnan86
Thanks. But may be i didnt find it correctly but am doing my best to find some books relted to that.. but i didnt.
if any one of you know any material which help me.i will be very very Thankful to him
http://productsearch.barnesandnoble....&pos=-1&ugrp=2
-
March 24th, 2011, 10:25 AM
#13
Re: Visual C++ MFC dialouge based application
Originally Posted by adnan86
Vs C++ 2010
If this is the Express (free) Edition, you won't be able to create MFC apps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|