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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:57:31+00:00 2026-05-17T20:57:31+00:00

I’m not able to use GetAltTabInfo. Probably a stupid mistake but what’s wrong with

  • 0

I’m not able to use GetAltTabInfo. Probably a stupid mistake but what’s wrong with this?

HWND taskSwitcher = FindWindow(L"TaskSwitcherWnd", L"Task Switching");
ALTTABINFO altTabInfo = {};
altTabInfo.cbSize = sizeof(ALTTABINFO);
GetAltTabInfo(taskSwitcher, -1, &altTabInfo, NULL, 0);

I have verified that taskSwitcher is the task switching window after the call to FindWindow (whether it is visible or not). All fields of altTabInfo remain 0 after the call to GetAltTabInfo except cbSize which was set to 40 by the assignment to sizeof(ALTTABINFO). I’m trying this on a windows 7 machine.

Alternative methods to extract the number of windows?

Thanks

Edit: Ok, I just realized I may get some error info. The result value of the GetAltTabInfo call is indeed 0 and GetLastError gives me either 1400 (Invalid window handle) or 1168 (Element not found) if I specify NULL for the hwnd parameter (it was after all defined to be __in_opt). So I guess I’m passing the wrong window. What is the right one if not the one returned by FindWindow(L”TaskSwitcherWnd”, L”Task Switching”)? MSDN only tells me about the hwnd parameter that “This window must be the application-switching window”.

  • 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-05-17T20:57:31+00:00Added an answer on May 17, 2026 at 8:57 pm

    You always have to check for errors when you use Win32 API functions. GetAltTabInfo returns BOOL, call GetLastError() when it returns FALSE:

    BOOL ok = GetAltTabInfo(hWnd, -1, &altTabInfo, NULL, 0);
    if (!ok) {
        int err = GetLastError();
        Log(err);   // Or whatever you use
        return false;
    }
    

    I’ll think you’ll see error 1400, “Invalid window handle”. On my machine, none of the window handles enumerated by EnumWindows() are accepted. I’d draw the conclusion that this API is no longer usable when you’ve got Aero enabled. I can’t find independent confirmation for this.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
For some reason, after submitting a string like this Jack’s Spindle from a text
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.