Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: WinAPI Using starting console  (Read 3822 times)

0 Members and 1 Guest are viewing this topic.

Veltas

    Topic Starter


    Intermediate

    Thanked: 7
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Linux variant
WinAPI Using starting console
« on: August 17, 2012, 05:15:40 AM »
How does one detect and attach itself to the console window it was started from (if it was started from a console window)?

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1140
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 11
Re: WinAPI Using starting console
« Reply #1 on: August 17, 2012, 05:22:09 AM »
You don't, at least not as I understand it.

Only way to be part of an existing console is to have the executable set as a Console program. Otherwise, it doesn't get a console, and the console that it started from oesn't belong to it's process so you couldn't AttachConsole() to it anyway.
I was trying to dereference Null Pointers before it was cool.

Veltas

    Topic Starter


    Intermediate

    Thanked: 7
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Linux variant
Re: WinAPI Using starting console
« Reply #2 on: August 17, 2012, 05:24:27 AM »
So no Windows applications can use their starting console?  That's a shame...

It's no massive deal, it's simple enough to AllocConsole.

Okay, thanks then.

Veltas

    Topic Starter


    Intermediate

    Thanked: 7
    • Yes
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Linux variant
Re: WinAPI Using starting console
« Reply #3 on: August 17, 2012, 05:26:58 AM »
How do you thank people for a post with the 'thanks' system?