Click here to Skip to main content
Click here to Skip to main content
Technical Blog

Tagged as

How to find whether the parent process is GUI or Console

, 10 Apr 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
This is not 100% fool proof. How ever in normal cases, this works great. This technique can be used to find out, whether the child application was launched from a GUI application or from a Console application.if( AttachConsole( ATTACH_PARENT_PROCESS )){ AfxMessageBox( _T("Parent process is a con

This is not 100% fool proof. How ever in normal cases, this works great. This technique can be used to find out, whether the child application was launched from a GUI application or from a Console application.

if( AttachConsole( ATTACH_PARENT_PROCESS ))
{
     AfxMessageBox( _T("Parent process is a console application"));
}
else
{
     AfxMessageBox( _T("Parent process is not a console application"));
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Naveen
Software Developer (Senior)
Singapore Singapore
No Biography provided

Comments and Discussions

 
GeneralMy vote of 1 Pinmember aphazel 死神12-Jan-10 3:37 
GeneralMy vote of 1 PinmemberBlkbam9-Apr-09 6:10 
GeneralRe: My vote of 1 PinmvpNaveen10-Apr-09 6:19 
AnswerThe C# way PinmemberBlkbam9-Apr-09 6:08 
GeneralRe: The C# way PinmemberQistoph9-Apr-09 21:09 
GeneralRe: The C# way PinmvpNaveen10-Apr-09 6:22 
GeneralMy vote of 1 PinmemberQistoph8-Apr-09 23:41 
GeneralRe: My vote of 1 PinmvpNaveen10-Apr-09 6:18 
GeneralRe: My vote of 1 Pinmvptoxcct27-Apr-09 3:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.1411023.1 | Last Updated 10 Apr 2009
Article Copyright 2009 by Naveen
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid