Adding functionality to controls on a GUI

This is a discussion on Adding functionality to controls on a GUI within the Windows Programming forums, part of the Platform Specific Boards category; I am brand new to Visual C++ programming. I started reading a book and the tutorials available here, and started ...

  1. #1
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257

    Adding functionality to controls on a GUI

    I am brand new to Visual C++ programming. I started reading a book and the tutorials available here, and started playing with some code.

    I've created a Button on a GUI in a dialog based project. Separatly I've written a console application that does something. Now, I took that code and pasted it in the event description of that Button.
    The original code uses a header file I've made. I've included it in the .cpp sourse for the GUI, but the compiler says that there is no such file or directory.
    Here's are some sections of the code to see where I put stuff:

    Code:
    // Initial GUI.cpp : Defines the class behaviors for the application.
    //
    
    #include "stdafx.h"
    #include "Initial GUI.h"
    #include "Initial GUIDlg.h"
    #include <BAFParse.h>
    
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif
    
    /////////////////////////////////////////////////////////////////////////////
    // CInitialGUIApp
    
    BEGIN_MESSAGE_MAP(CInitialGUIApp, CWinApp)
    	//{{AFX_MSG_MAP(CInitialGUIApp

    Code:
    void CInitialGUIDlg::OnOpenFile() 
    {
    
       FILE *inp;
       int SpaceLeftU, NameLengthU, SpaceLeftP;
       char **Units, **Params;
    ................................

  2. #2
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    Did you move/copy the header file to your new project's directory along with #including it?, or did you leave it in it's old directory, where your new project has no knowledge of how to find it?

    #include <BAFParse.h> technically should use quotations: #include "BAFParse.h" since it's not a standard library.

    Additionally, if there is a BAFParse.cpp, did you either include it in your project or a library created from it. Otherwise you will have other errors as well once you get the headers problems sorted out.

  3. #3
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257
    I've added all the sourse files and the header file to the project, and moved all the files into the same folder.
    So the header file problem is gone. BUT...
    I have sourse files for function I've craeted to support the executable portion. They are in separate files, and the compiler gives me this error:
    Code:
    h:\gui\initial gui\getdata.c(102) : fatal error C1010: unexpected end of file while looking for precompiled header directive
    IndexRead.c
    Last edited by earth_angel; 06-17-2005 at 06:11 AM.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    That error sounds like you have not included stdafx.h in the getdata.c file.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dynamic adding of Controls
    By WDT in forum C# Programming
    Replies: 5
    Last Post: 04-22-2009, 07:59 AM
  2. Dynamically adding method to created controls
    By earth_angel in forum Windows Programming
    Replies: 4
    Last Post: 06-26-2005, 07:11 PM
  3. Adding functionality to controls on a GUI
    By earth_angel in forum C++ Programming
    Replies: 3
    Last Post: 06-16-2005, 01:35 PM
  4. confused about adding controls to main window
    By terracota in forum Windows Programming
    Replies: 4
    Last Post: 11-24-2004, 11:35 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21