Solved

Debugging a call to a function from OnButton1 Event

Posted on 2004-10-25
252 Views
Last Modified: 2013-11-20
I have a function that is called within an OnButton event.  When I place it in this function, it is skipped over in code and when I try to debug...but no errors are generated.  If I put the instructions of that function in the OnButton space, it works.  I can't figure out WHAT I'm doing wrong.  Does anyone have any ideas?

Here is the code:

void CUIMFCDlg::OnButton1()
{

                void Readcfgini();  //This is the call to the real function
                //This is the code for the function itself.  It returns data to my listbox
                //When I perform from here, it will actually execute the ScanDir Function and then return data to the list box.
      char **dirarray;
      char *scandir;
      scandir = "C:\\UI Code and Executable\\UIMFC\\UIMFC\\Debug\\programs";
      dirarray = 0;
      dirarray = ScanDir( scandir , 0);


      CString temp;
      for(int i=0;i<sizeof(dirarray);i++){
            temp.Format("%d", dirarray[i]);
            m_list.AddString(temp);}
}
//The called function
void Readcfgini()
{
      char **dirarray;
      char *scandir;
      scandir = "C:\\UI Code and Executable\\UIMFC\\UIMFC\\Debug\\programs";
      dirarray = 0;
      dirarray = ScanDir( scandir , 0);


      CString temp;
      for(int i=0;i<sizeof(dirarray);i++){
            temp.Format("%d",dirarray[i]);
            m_list.AddString(temp);
}
0
Question by:vivekpara
    3 Comments
     
    LVL 7

    Accepted Solution

    by:
    In OnButton1() you seem to have:

     void Readcfgini();  //This is the call to the real function

    which is a declaration, not a call. Remove the "void" so you have

      Readcfgini();  //This is the call to the real function

    0
     
    LVL 2

    Author Comment

    by:vivekpara
    Why copying and pasting can be a bad thing.

    I swear I looked at it a million times and didn't notice that.  =)

    Thank You!
    0
     
    LVL 7

    Expert Comment

    by:jimwasson
    No problem. It happens to me a lot!
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Title # Comments Views Activity
    how to handle null argument in python 4 82
    List out all word 7 162
    has22 challenge 11 46
    modThree challenge 4 42
    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    910 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now