Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8785155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:16:50+00:00 2026-06-13T21:16:50+00:00

I have a class heirarchy of: class BaseProcess { public virtual void Execute() =

  • 0

I have a class heirarchy of:

class BaseProcess
{
    public virtual void Execute() = 0;  

};

class SubProcess : BaseProcess
{
    public virtual void Execute()
    {
        //Do Something

        //Need to call back to the GUI here, maybe to get a file path from a file selector

        //Do Something Else

        //Now want to update the GUI with the progress of the operation perhaps

        //More processing   
    }
};

Assuming that a SubProcess object is created and called from a GUI button event handler…

My question is what is the best way to interact with the GUI from within the Execute() function? (Also assuming that that Execute() may be running on a different thread)

The idea I had was to pass a Callback into the SubProcess object, as this would allow me to send info to the GUI, however in the case of a File Selector, what would be the best way to get the data back to the SubProcess object? I would like the solution to be as generic as possible so I could return different types of data, depending on the request.

Note: Please ignore any code mistakes, I knocked the sample together quickly just to illustrate the problem

Update:

Sorry to be clear, this would be on Windows, MFC. I’m not sure how much this matters as I think the overall design should be applicable to most GUI frameworks?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:16:53+00:00Added an answer on June 13, 2026 at 9:16 pm
    class SubProcess : BaseProcess
    {
        public virtual void Execute()
        {
            //Do Something
    
            char file_name[MAX_PATH +1];
            myWindow->SendMessage(WM_GETFILE, max_path, (LPARAM)file_name); 
    
            //Do Something Else
    
            myWindow->SendMessage(WM_UPDATE, 50);
    
            //More processing   
        }
    };
    

    And in the window class:

    #define WM_GETFILE (WM_USER+1)
    #define WM_UPDATE (WM_USER+2)
    
    BEGIN_MESSAGE_MAP(CMyWindow, CWnd)
        ON_MESSAGE(WM_GETFILE, MyGetFileHandler)
        ON_MESSAGE(WM_UPDATE, MyUpdateHandler)
    END_MESSAGE_MAP()
    
    LRESULT CMyWindow::MyGetFileHandler(WPARAM wParam, LPARAM lParam)
    {
    }
    LRESULT CMyWindow::MyUpdateHandler(WPARAM wParam, LPARAM lParam)
    {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose you have the following Generic class heirarchy: public abstract class GenericBase<T> { T
I have the following class hierarchy public abstract BaseClass : System.Web.UI.UserControl { public virtual
Let's say I have these class hierarchy : public abstract class Parent { }
Suppose I have the following class heirarchy: class A() class B(a:A) class C(b:B) class
Suppose I have class hierarchy like the one shown in picture. Suppose I need
I have this class hierarchy: public interface ISR { } public interface ICU {
I have a class hierarchy and i am writing a virtual function in it.
A have a class hierarchy that looks somethign like this: class AbstractDataType { public:
I have a several models in a heirarchy, 1:many at each level. Each class
I have a class hierarchy that looks like this: class Base<TElement> { public TElement

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.