CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13
  1. #1
    Join Date
    Mar 2011
    Posts
    14

    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.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Visual C++ MFC dialouge based application

    What version and what edition of Visual C++ are you using?

  3. #3
    Join Date
    Mar 2011
    Posts
    14

    Re: Visual C++ MFC dialouge based application

    Vs C++ 2010

  4. #4
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    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 ►►

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Visual C++ MFC dialouge based application

    Quote Originally Posted by adnan86 View Post
    ...
    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

  6. #6
    Join Date
    Mar 2011
    Posts
    14

    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.

  7. #7
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    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.

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Visual C++ MFC dialouge based application

    Quote Originally Posted by adnan86 View Post
    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

  9. #9
    Join Date
    Mar 2011
    Posts
    14

    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.

  10. #10
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Visual C++ MFC dialouge based application

    Quote Originally Posted by adnan86 View Post
    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.

  11. #11
    Join Date
    Mar 2011
    Posts
    14

    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

  12. #12
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Visual C++ MFC dialouge based application

    Quote Originally Posted by adnan86 View Post
    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

  13. #13
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Visual C++ MFC dialouge based application

    Quote Originally Posted by adnan86 View Post
    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
  •  





Click Here to Expand Forum to Full Width

Featured