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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:45:32+00:00 2026-05-15T23:45:32+00:00

Win32’s FindWindow() can find a window having the title of Untitled – Notepad, but

  • 0

Win32’s FindWindow() can find a window having the title of “Untitled – Notepad”, but what if I just want to find a Notepad window but don’t know whether it is “try.bat – Notepad” or some other file name on the title bar?

It seems that if the title is passed in a NULL value, then any window will be returned, but only one window is returned, so there is no way to grep for the title using regular expression.

(I am doing this using Ruby’s Win32API)

  • 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-15T23:45:32+00:00Added an answer on May 15, 2026 at 11:45 pm

    I would follow Eric’s advice to use EnumWindows. You can provide Ruby callbacks to Windows API functions through win32-api. Here’s an example that was trivially modified from the sample in the win32-api README:

    require 'win32/api'
    include Win32
    
    # Callback example - Enumerate windows
    EnumWindows     = API.new('EnumWindows', 'KP', 'L', 'user32')
    GetWindowText   = API.new('GetWindowText', 'LPI', 'I', 'user32')
    EnumWindowsProc = API::Callback.new('LP', 'I'){ |handle, param|
      buf = "\0" * 200
      GetWindowText.call(handle, buf, 200);
    
      if (!buf.index(param).nil?)
        puts "window was found: handle #{handle}"
        0 # stop looking after we find it
      else
        1
      end
    }
    
    EnumWindows.call(EnumWindowsProc, 'Firefox')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Win32 I want to suspend a thread using Suspend(GetCurrentThread()); but I find I
in win32, we can use SetWindowRgn to give the window a round corner, how
What win32 calls can be used to detect key press events globally (not just
Win32's CreateFile has FILE_FLAG_DELETE_ON_CLOSE , but I'm on Linux. I want to open a
win32 windows application and want to capture full screen and remove the border of
On Win32, how can a C++ program determine how many threads are active in
For a Win32 Portable Executable (PE) How can I get the list of classes
So I have a WIN32 app that records videos using DirectShow. Now I want
I'm creating a Win32 project, and I'm trying to use TCHAR everywhere. But since
Win32 newbie here. I've been having some issues with using one of the standard

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.