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

  • SEARCH
  • Home
  • 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 9122399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:05:44+00:00 2026-06-17T06:05:44+00:00

I have c# console application (Net framework 4.5, visual studio 2010 express). I can

  • 0

I have c# console application (Net framework 4.5, visual studio 2010 express). I can run this app by using cmd and its work normally. But with some very important reason I need run this app from other app that write on the c++. I have tried to run c# app by using ShellExecute, CreateProcess, WinExec. It’s always crash and don’t run at the same machine where I launched it before by using cmd. Is there still are any ways to start this c# app. Or need I compile/assemble this c# app with some special way?
Uppdate
example:

METHOD 1

SHELLEXECUTEINFO ShExecInfo = {0};  
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);   
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;  
ShExecInfo.hwnd = NULL;  
ShExecInfo.lpVerb = NULL;  
ShExecInfo.lpFile = "C:\\PATH\\To\\THE\\APP.exe";  
ShExecInfo.lpParameters = szParameters;  
ShExecInfo.lpDirectory = NULL;  
ShExecInfoFlash.hInstApp = NULL;  
ShellExecuteEx(&ShExecInfoFlash);  
WaitForSingleObject(ShExecInfoFlash.hProcess,INFINITE); 

Method 2

PROCESS_INFORMATION pi; 
char bff[512]; 
memset(&si,0,sizeof(si)); 
si.cb=sizeof(si); 
if(!CreateProcess(NULL,szParameters,NULL,NULL,0,0,NULL,NULL,&si,&pi)) 
{ return TS_METHOD_ABORTED;} 
WaitForSingleObject(pi.hProcess,INFINITE); 
CloseHandle(pi.hProcess); 
CloseHandle(pi.hThread);

And it’s crashed always with the same way. It’s told me that something unexpected happened and propose me to send report to the MS.

  • 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-17T06:05:45+00:00Added an answer on June 17, 2026 at 6:05 am

    I haven’t done what you are trying to do in c++ in a long time, but I did it recently in c#. I know this is half an answer, so sorry in advance for that. Does ShellExecute in c++ (or any of the other methods) give you the ability to set the working directory of the program you are launching? I’ve found that sometimes without setting this, the program being launched will think that it is running in a system folder, and as a result it may be unable to load resources because the relative paths are wrong.

    Hope it helps.

    Edit:

    It appears ShellExecute does have what you are looking for.

    Now that an example was posted, from above:

    SHELLEXECUTEINFO ShExecInfo = {0};  
    ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);   
    ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;  
    ShExecInfo.hwnd = NULL;  
    ShExecInfo.lpVerb = NULL;  
    ShExecInfo.lpFile = "C:\\PATH\\To\\THE\\APP.exe";  
    ShExecInfo.lpParameters = szParameters;  
    ShExecInfo.lpDirectory = NULL;  
    ShExecInfoFlash.hInstApp = NULL;  
    ShellExecuteEx(&ShExecInfoFlash);  
    WaitForSingleObject(ShExecInfoFlash.hProcess,INFINITE); 
    

    First, I recommend trying to launch another program you KNOW should work, like notepad.exe.

    Next, like I said originally, set the working directory to match the exe.

    ShExecInfo.lpFile = "C:\\PATH\\To\\THE\\APP.exe";  
    ShExecInfo.lpParameters = szParameters;  
    ShExecInfo.lpDirectory = "C:\\PATH\\To\\THE";  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a .NET application in C# (.NET Framework 3.5 console application) using Visual
Consider we have .NET Winforms application or Console Application. Can anyone tell me what
I have included the following statement in my Visual C# Console Application (Visual Studio
I've created an empty console application in Visual Studio 2010 and I'm attempting to
I have a solution in Visual Studio 2010 containing 6 projects (1 web application,
I have created a simple c# console application with .net framework 2.0 that uses
I have a .NET console application that needs to generate some HTML files. I
I have a .net Console Application called FooConsole. When I build and deploy it,
I have a console application which has target .NET 2.0 It is very short
In .NET c# 3.5 I have a console application (A) that references several assemblies(X,

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.