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

    Question Hooking onto a console window

    In general, I'm coding an external program with Ruby and would like to issue some API commands, but I'm afraid this is where Ruby becomes limited in its ability.

    I want to have the console window set to be "Always on Top" in a sense. So how would I go about hooking onto a console and bring it to the top with C++ and Window's API?

    I'm running into confusion with SetWindowPos() and SetForegroundWindow()

    Any help/advice is much appreciated

    Thanks,

    - Mac

  2. #2
    Join Date
    Apr 2009
    Posts
    598

    Re: Hooking onto a console window

    See MSDN description of SetWindowPos() function at http://msdn.microsoft.com/en-us/libr...45(VS.85).aspx , where it is said:
    If an application is not in the foreground, and should be in the foreground, it must call the SetForegroundWindow function.
    My understanding is that there are two z-orders: one for the display, and another one (not named "z-order" in the manuals) for the keyboard and events.

    SetWindowsPos() changes the z-order for the screen.
    SetForegroundWindow() changes both the z-order for the screen and for the keyboard.

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