Modular programming, running an external application .exe from a menu item of my own app

brickoff 0 Reputation points
2023-03-04T22:56:28.6733333+00:00

Hi everybody, first at all, many thanks for reading my post.

I’ve developed an application to graph mathematical functions and expressions. This application has been developed using Visual C++ ’22 in a Windows 10 environment. This has been implemented using MDI, MFC and the public class CFormView from MFC.

This application graph one and two variable functions, curves in 3D, parametric functions in 2D and 3D as well polar functions in polar coordinates 2D and 3D.

Each graph is done by specialized routines monolithically incorporated within of the main app.

When the user open the application, appeared a menu bar and submenus, as is shown below.
menu_F_3D

When the user chooses 2D Cartesians coordinates, appear a form in order to allow the user to introduce the necessary data. After the form has been fill out, the user press de Graph (Graficar) button and the corresponding routine (placed in the main app) plot the graph as is shown bellow.

function_3D

I want to build a modular application in which the routines are independents each other.

I’ve built a main app to show only the menu bar and submenus, just as is shown in the first image, as well an executable application to plot two variable functions in 3D. Both of them have been built using visual c++ ’22.

The executable in charge of graph 2 variable functions in 3D is called function3D.exe.

I’m sending to the forum the source code of the childFrm.cpp of my current app, in where I set the Dialog resourses used to call each routine.

And then, the question is: How and from where can I call function3D.exe from childFrm.cpp in my new app? If there are a possibility to do it, of course. If you’ve another way to do it, please don’t hesitate to tell me.

Please, neither .dll nor activeX controls, windows visual c++ .exe code only.

Many thanks to read my question.

Developer technologies Visual Studio Extensions
Developer technologies Visual Studio Testing
Developer technologies Visual Studio Setup
Developer technologies C++
Developer technologies Visual Studio Other
{count} votes

1 answer

Sort by: Most helpful
  1. YujianYao-MSFT 4,296 Reputation points Microsoft External Staff
    2023-03-06T05:27:31.7133333+00:00

    Hi brickoff,

    I created an MFC program that successfully calls another .exe file in a .cpp using WinExec().

    Sample code is as follows:

    WinExec("C:\\Users\\Administrator\\Desktop\\Newfolder\\MFCApplication4\\x64\\Debug\\ConsoleApplication1.exe", SW_SHOW);
    

    The first parameter specifies the path and the second specifies the display mode. Where ConsoleApplication1.exe is a c++ console program I created. You could add this code to a click event to do this.

    Best regards,

    Elya


    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.