none
Converting a Windows 7 / Visual Studio 2008 C++ WinForm / multi form program to run on Windows 10. RRS feed

  • Question

  • Windows 10 does not support VS 2008, so I downloaded the VS 2019 free version, which does not support C++ WinForm, so I downloaded the “C++/CLR Windows Forms for Visual Studio” extension.

    I was able to create the main form and all of the code that makes the program function properly.  I then tried to create my first pop-up form to manage the data that the main form uses.  When I right click the project and Add / New Item… , the list of options for Visual C++ does not include “UI” so I can’t add the necessary sub-forms!

    Simple question: what are my options?  What versions of Visual Studio 2019 | 2017 | 2015 | 2013 | 2012 | 2010 | 2008 still support WinForm for C++? What versions will run on Windows 10? Is there a way to add additional sub-forms to the “CppCLR WinformsProjekt” created by the 2019 downloaded extension?

    Sunday, October 18, 2020 12:12 AM

All replies

  • I came up with a workable, but not very nice solution to this problem:

    I created a second WinForm project with a single form1 to manage the desired data.

    Click the "Watch" button on the main form and it executes the second Winform executable.


    private: System::Void WatchButton_Click(System::Object^ sender, System::EventArgs^ e)
    {
    system("Watch.exe");
    ReloadWatchFile();
    RefreshThePage();
    }


    After you exit the secondary form, the main form reloads the updated data and refreshes the main form screen.

    The problem that I still have, but it does not STOP the process, is that the system() command brings up a command prompt window, then displays the secondary form on top of that, so you lose the ability to see the primary form while you are updating the data on the secondary form!

    But, it does work, it does the job!

    Is there another command sequence other that system(...) that will execute the Watch.exe process directly?

    Sandy


    Tuesday, October 20, 2020 4:13 PM
  • Microsoft removed the templates for creating Windows Forms projects in C++ from Visual Studio versions after VS2010.  And VS2010 has reached End of Life and is officially out of support.

    You may find the following thread from the archived forums to be helpful.  It discusses how to create Windows Forms projects for C++ in VS2017 without the need for any extensions.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/a9529502-6304-4aa6-90ee-0757ab258d87/create-c-windows-forms-application-in-visual-studio-2017?forum=winforms

    Tuesday, October 20, 2020 5:37 PM
  • I found an almost perfect solution to the command prompt window existing when my secondary WebForm is displayed!

    My execution code now calls a batch file which used the Microsoft powershell to minimize the unwanted window before executing the second WebForm.

    // WatchButton

    private: System::Void WatchButton_Click(System::Object^ sender, System::EventArgs^ e)

       {

          ClearWatchList();

          system("Watch.bat");

    //    system("Watch.exe");

          LoadWatchList(0);

          if (RebuildPage(0))      RefreshThePage();

       }

     

    The Watch.bat file contains:

     

    powershell -window minimized -command ""

    Watch.exe

     

    The unwanted command prompt window is only there for a split second, then it disappears.  The other suggestions that I found on line did not wait for the Watch WinForm to exit before returning control to the primary WinForm.


    Thursday, October 29, 2020 3:43 AM
  • I have an old c++ winforms project that still builds and runs fine  under VS2019.

    If you want to start a new project take a previous project and copy the directory to a temp directory.

    In the temp directory delete the hidden directory "vs"

    Remove all the forms and body from your new project and use that or add in the forms and body from an old project.

    MS has a habit of whipping the carpet out from under you when they remove templates.


    n.Wright

    Wednesday, November 4, 2020 12:20 PM
  • Thanks Nigel,

    That is worth a try.  One question, after the project has been converted, can you then add additional forms to it?  IE: when you right click the project, select Add, then select New Item, does the list of C++ optional Code Types include UI (User Interface, a secondary form)?  If not, how do you then add a secondary Form to the primary Form?

    Thursday, November 5, 2020 2:39 PM
  • I spent some time today on the problem.

    If you go into Visual Studio install  and click on "individual components "you can add C++/CLI support for v142 build tools (14.28)

    And this will allow you to add new forms.

    I spent an hour on this so you owe me a pint !


    n.Wright


    Thursday, November 5, 2020 3:57 PM