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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:21:02+00:00 2026-05-18T04:21:02+00:00

This is a somewhat unusual problem. I’m presently working on an effort to automate

  • 0

This is a somewhat unusual problem. I’m presently working on an effort to automate an Office application. Basically the issue is that my app is able to interact with the Office app correctly when I execute my app via RDP, but I am unable to send keystrokes using SendInput() if I set up the application to spawn from a windows service. OS is Win03 Std.

When spawning the app from a windows service I’m able to read window captions, automate through the interop, etc. as expected via pinvoke, but the SendInput() messages seemingly vanish even though the call returns a 1. All I’m trying to do at this point is send an escape keystroke to a dialog.

I’ve tried sending the keystrokes both as virtual keys and scancodes.

Any ideas or tips? Thanks in advance!

(BTW: I do realize that this sort of automation isn’t supported/sanctioned by MSFT.)

EDIT:
Just in case anyone else has this issue, this works:

[DllImport("user32")]

public static extern bool PostMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);


bool returnVal = NativeWin32.PostMessage(popup, 0x0100, new IntPtr(0x1b), IntPtr.Zero);
  • 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-18T04:21:02+00:00Added an answer on May 18, 2026 at 4:21 am

    I believe that SendInput will send keys to current active window (or window that has focus). Typically, windows services would be associated with different desktop (that interactive desktop) – so App launched from windows service would also be associated with the background desktop – so no active window (or window with focus) and that’s may be the reason sendinout not working. You can perhaps try simulating key click by using SendMessage or PostMessage – you will need window handle for that.

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

Sidebar

Related Questions

I have a somewhat unusual problem. In my app, I am shadowing a UIImageView
We have a somewhat unusual c app in that it is a database of
I have this somewhat working though it's important to understand the setup. With multi-domain
This somewhat follows on from the question Saving application data to the ipad/iphone Really
This is somewhat related to my previous question but I've realised that I needed
I'm working on an Android application with an activity that uses a tab layout.
Greetings to all of you. I have this somewhat frustrating problem, and I hope
Once and for all I want to clearify this somewhat subjective and argumentative area
Is it possible to have nested set capabilities in this somewhat custom setup? Consider
This is somewhat complex (well to me at least). Here is what I have

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.