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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:47:59+00:00 2026-06-11T16:47:59+00:00

I try to retrieve some information(x,y,width,height and title) for all opened window on Windows

  • 0

I try to retrieve some information(x,y,width,height and title) for all opened window on Windows with a simple C++ code(see below):

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

BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int     iCmdShow)
{
    EnumWindows(EnumWindowsProc, NULL);
    //system("PAUSE");
    return 0;
}

BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
char class_name[255];
char title[255];
int tmpWidth;
int tmpHeight;
HWND currenthwnd;
RECT WindowRect;

GetClassName(hwnd,class_name, sizeof(class_name));
GetWindowText(hwnd,title,sizeof(title));
GetWindowRect(hwnd,&WindowRect);

//if(WindowRect.left>-50 && title != "" && title != NULL && strlen(title)>0){
    tmpHeight = WindowRect.bottom - WindowRect.top;
    tmpWidth = WindowRect.right - WindowRect.left;
    cout <<"@@##@@"<<title<<",(@@#@@)";
    cout <<WindowRect.left<<",(@@#@@)";
    cout <<WindowRect.top<<",(@@#@@)";
    cout <<tmpWidth<<",(@@#@@)";
    cout <<tmpHeight<<",(@@#@@)";
    currenthwnd=GetForegroundWindow();
    if (currenthwnd!=hwnd){
       cout <<title<<",(@@#@@)false";
    }else{
       cout <<title<<",(@@#@@)true";
    }
 //}

 return TRUE;
}

But I encountered some issue with this code, I also try with PowerShell with Get-Process function, but this function doesn’t return all opened windows but all existing process.

How can I retrieve title, x,y, with, heigth of all opened window ?

Thanks for your help

  • 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-11T16:48:00+00:00Added an answer on June 11, 2026 at 4:48 pm

    In powershell you can use the WASP Module and wrote something like this:

    Get-Process | Where-Object {$_.MainWindowTitle -ne ""}  | 
    % {$_.processname + "-" + $_.mainwindowtitle;
           Get-WindowPosition -Window $_.handle }
    

    This is a result example for my actual powershell windows:

    powershell - Posh - Admin
    Location : {X=4,Y=44}
    Size     : {Width=885, Height=129}
    X        : 4
    Y        : 44
    Width    : 885
    Height   : 129
    Left     : 4
    Top      : 44
    Right    : 889
    Bottom   : 173
    IsEmpty  : False
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to retrieve some data from JSON object which holds location information such
I'm trying to retrieve user information in Active Directory, but am finding some things
I'm trying to retrieve some information from my onActivityResult method, in my case is
I try to retrieve a list of the attribute values of the children of
I am currently try to retrieve a latitude and longitude value from a location.
I am using mysqli to try and retrieve the teacher's username and then insert
I get a Data type mismatch criteria expression error when i try to retrieve
I'm trying to retrieve this page using Apache HttpClient: http://quick-dish.tablespoon.com/ Unfortunately, when I try
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
Try this piece of code - public class WhitespaceTest { public static void main(String[]

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.