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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:11:23+00:00 2026-06-16T15:11:23+00:00

Well, I’ve tried my best to look at code examples and posts all over

  • 0

Well, I’ve tried my best to look at code examples and posts all over the web on how to do this, but I haven’t been able to make any headway in a few months using windows API to interact with another program that’s already running. I’m not the greatest programmer and some of this stuff is beyond me.

The most I’ve been able to do is find the Calculator process and its handle, and use that with SetWindowText to change the title. What I’d really like to learn how to do is make my program use the windows user32 (I think this must be the correct library) to enter some numbers by actually pressing the number key buttons on the software calculator to do a simple calculation.

I don’t really have a use for this program, it’s just a goal I’m trying to reach to learn how to use the windows API past my very beginner level SPECIFICALLY in C#. If no one has the code for this, or even if you do, I’d most appreciate some suggestions for books or resources on the web I should be reading to learn how to do this.

  • 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-16T15:11:26+00:00Added an answer on June 16, 2026 at 3:11 pm

    Since you say you’re using C# you should be using the System.Windows.Automation namespace, whose entire purpose in life is to allow you to control other programs via automation.

    You didn’t give details as to what you wanted, but here’s a program that pushes “7” in the calculator.

    using System.Windows.Automation;
    
    class Program
    {
     public static void Main()
     {
      var calcWindow = AutomationElement.RootElement.FindFirst(
       TreeScope.Children,
       new PropertyCondition(AutomationElement.NameProperty, "Calculator"));
      if (calcWindow == null) return;
    
      var sevenButton = calcWindow.FindFirst(TreeScope.Descendants,
       new PropertyCondition(AutomationElement.NameProperty, "7"));
    
      var invokePattern = sevenButton.GetCurrentPattern(InvokePattern.Pattern)
                         as InvokePattern;
      invokePattern.Invoke();
     }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well im new to javascript but why does this not work, all i want
Well I guess this is not a normal how-to-do-this-or-that stackoverflow question, but perhaps someone
Well this question is quite common and i also searched and tried many answeres,
Well this kind of n00b question but I still can't figure it out. I
Well I have been thinking about this for a while, ever since I was
Well the problem is that I have this enum, BUT I don't want the
Well, i have such-like code that prevent select all action from keyboard: $(document).keydown(function(e){ //
Well the problem is that I was using code like this: new Date().toJSON().slice(0, 10)
Well I think this is kinda dumb but, I wonder if there's any way
Well, first I know that this question was already asked several times. But I

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.