CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2018
    Posts
    6

    Windows form launching a console application

    I have a C# console application that is launched from a WinForm application.
    The output of the console application is well-formatted; however, user can run the console application directly. Is there a way to restrict/force the console application to be only run from the main application (WinForm)?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Windows form launching a console application

    Use a named mutex. Create the mutex in the windows app before you launch the console app. When the console app starts up, try to open the mutex. It should open. If the mutex doesn't exist and the console app can't open it, you can assume the console app wasn't launched by the windows app.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured