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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:23:34+00:00 2026-06-19T04:23:34+00:00

I have a function where i can react on appearing windows. Now i want

  • 0

I have a function where i can react on appearing windows. Now i want to know if the appearing window is a Messagebox. And if it is one, i want to read the text of it.

I’m already able to extract the Window-Title, Class-Name and Process-Id by

[DllImport("user32.dll", CharSet = CharSet.Unicode)]
internal static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);

[DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);

[DllImport("user32.dll")]
internal static extern int GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId);

But how can i find out the text of a messagebox?

To get all windows i am using this:

internal static class WindowFinder
    {
    private static readonly List<IntPtr> listWindows = new List<IntPtr>();

    private static bool IsWindowOrDialog(IntPtr hwnd, int lParam)
    {
        if (NativeMethods.IsHungAppWindow(hwnd) || !NativeMethods.IsWindowVisible(hwnd))
            return true;
        listWindows.Add(hwnd);
        return true;
    }

    internal static IEnumerable<IntPtr> GetAllWindows()
    {
        listWindows.Clear();
        NativeMethods.EnumWindows(IsWindowOrDialog, IntPtr.Zero);
        return listWindows;
    }
}
  • 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-19T04:23:36+00:00Added an answer on June 19, 2026 at 4:23 am

    I don’t know what you’re trying exactly but you can:

    1. FindWindow
    2. GetDlgItem and extract the text using
    3. GetWindowText

    Since MessageBoxes are of type static (0xFFFF), you should use GetDlgItem and GetWindowText like this:

    IntPtr dlgHandle = GetDlgItem(MboxHandle, 0xFFFF);
    GetWindowText(dlgHandle, yourStringBuilder, maxTextCount);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function that can accept any number of arguments... const getSearchFields =
I have a function I can't modify: function addToMe() { doStuff(); } Can I
Suppose I have a function which can either take an iterable/iterator or a non-iterable
I would like to have a function that can wrap any other function call.
In JavaScript, if I have some function I can use the arguments object to
Can function argument have hint in cfscript (CF9)? CFML style: <cffunction name=myFunc output=false returntype=void>
I have a function where I can add articles and users can comment on
Given i have the IO function: // this can either be IO or some
In C and C++ we have the memset() function which can fulfill my wish.
Can I´m asking for advice. I have function which should return javascript object function

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.