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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:33:11+00:00 2026-06-10T09:33:11+00:00

In my Win32 VCL application I am using ShellExecute to launch a number of

  • 0

In my Win32 VCL application I am using ShellExecute to launch a number of smaller Delphi console applications. Is there a way to control the position of those console windows? I would like to launch them centered on screen.

  • 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-10T09:33:13+00:00Added an answer on June 10, 2026 at 9:33 am

    If you have control over the console application, You could set the console window position from inside the console application itself:

    program Project1;
    {$APPTYPE CONSOLE}
    uses
      Windows,
      MultiMon;
    
    function GetConsoleWindow: HWND; stdcall; external kernel32 name 'GetConsoleWindow';
    
    procedure SetConsoleWindowPosition;
    var
      ConsoleHwnd: HWND;
      R: TRect;
    begin
      ConsoleHwnd := GetConsoleWindow;
      // Center the console window
      GetWindowRect(ConsoleHwnd, R);
      SetWindowPos(ConsoleHwnd, 0,
        (GetSystemMetrics(SM_CXVIRTUALSCREEN) - (R.Right - R.Left)) div 2,
        (GetSystemMetrics(SM_CYVIRTUALSCREEN) - (R.Bottom - R.Top)) div 2,
        0, 0, SWP_NOSIZE);
    end;
    
    begin
      SetConsoleWindowPosition;  
      // Other code...
      Readln;
    end.
    

    If you can’t recompile the console application, you could use FindWindow('ConsoleWindowClass', '<path to the executable>') to obtain the console window handle (the Title parameter could vary if it was set via SetConsoleTitle).
    The downside with this approach, is that the console window is seen “jumping” from it’s default position to it’s new position (tested with Windows XP).

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

Sidebar

Related Questions

I am using Delphi XE2 to write a VCL win32 application. Delphi XE2 support
Delphi 2010, Win32 VCL. I need to create a main menu for my application
I am using win32 console application with out having any dependency with dotnet framework.
I'm translating the following C++ component to Delphi: http://borland.newsgroups.archived.at/public.delphi.vcl.components.using.win32/200708/0708225318.html But it's not working... I'm
Our win32 application assembles objects from the data in a number of tables in
I am using the Win32 API call SetForegroundWindow to set focus to another application's
My team is maintaining a huge Client Server win32 Delphi application. It is a
In writing Win32 C/C++ code, is there any advantage (e.g. performance?) in using Windows-specific
I'm writing Win32 console application, which can be started with optional arguments like this:
I have a Win32 application that makes ODBC-Connections. We connect using SQLDriverConnect() which displays

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.