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 1021731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:21:17+00:00 2026-05-16T11:21:17+00:00

I got two console applications that the first one runs the second one: 1_first

  • 0

I got two console applications that the first one runs the second one:

1_first console application:

#include <Tchar.h>
#include <windows.h>
#include <iostream>
using namespace std;

void main(){
 PROCESS_INFORMATION obj1;
 memset(&obj1,0,sizeof(PROCESS_INFORMATION));
 STARTUPINFOW obj2;
 memset(&obj2,0,sizeof(STARTUPINFOW));
 obj2.cb=sizeof(STARTUPINFOW);
 CreateProcessW(_TEXT("c:\\runme.exe"),_TEXT("hello what's up?"),NULL,NULL,FALSE,NULL,NULL,NULL,&obj2,&obj1);
}

2_second console application named runme.exe:

#include <stdio.h>
#include <iostream>
using namespace std;

int main(int argc,char * * argv){
 if (argc>0)
  for (int i=0;i<argc;i++)
   cout <<"**->**"<<argv[i]<<"\n";
}

Now my problem is that both applications will use the same command prompt window, what should I do to get them using separate ones ?

  • 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-05-16T11:21:18+00:00Added an answer on May 16, 2026 at 11:21 am

    Pass CREATE_NEW_CONSOLE in the process creation flags (sixth parameter) when you call CreateProcess.

    CreateProcessW(L"c:\\runme.exe",L"hello what's up?",NULL,NULL,FALSE,CREATE_NEW_CONSOLE,NULL,NULL,&obj2,&obj1);
    

    When you call CreateProcessW you do not want to use _TEXT on strings. CreateProcessW always takes wide strings, so you should always use an L prefix on them. _TEXT (or _T) is only for use with CreateProcess (no suffix), so it can change from narrow to wide strings based on whether you define UNICODE/_UNICODE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got two console processes that second one is created by first one using
I got two data storages in my Windows Azure account. One is for the
I've got a simple object post that has two NSMutableArrays as properties. One is
I've got a backbone.js application that defines two controllers, and the controllers both define
I have a console application that i got to make and i would like
I got an application written in java which runs on Unix and starts two
I got two tables, one of which is a helper of the other. The
I've got a web application that has a page full of batch files which
I've got a Windows application (written in C, compiled with MSVC Express edition, 32-bit
I've got a div with two children, one <h2> and one <ul> . My

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.