-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Presskey doesn't work when adding to new project as library #2
Comments
@Shinigamae is there an app I can send keystrokes to as an example for you? |
Sorry, I don't understand your question. Do you mean my application or the application I want to send keystrokes to? |
the application you want to send the keystokes and mouse events to On Wed, Jan 6, 2016 at 10:46 PM, Khanh Nguyen notifications@github.com
|
It is BlueStacks app player which is used to emulate Android on Windows. You can download it at http://filehippo.com/download_bluestacks_app_player/ (300 MB+) It has a feature to map a keystroke to a tap on its app screen. |
If you ever want to see my project, I can provide it. Just a small keypress app to use with BlueStacks. Thanks. |
yeah if you don't mind just email it to me, i can sign a NDA if i need to On Thu, Jan 7, 2016 at 11:54 AM, Khanh Nguyen notifications@github.com
|
I would love to see the DLL to be improved further than it is currently. |
So I changed some of your code in Main.cs private void timerMain_Tick(object sender, EventArgs e)
{
try
{
counter++;
if (chkShutdown.Checked)
{
countdown--;
lblCountdown.Text = String.Format("({0} seconds remaining)", countdown);
if (countdown == 0) ExecuteShutdown(cbShutdownOptions.SelectedValue.ToString());
}
if (counter > list.Max(c => c.Value)) counter = 1;
foreach (var l in list.Where(c => counter % c.Value == 0))
{
var key = new Keyboard.Key(l.Key[0]);
if (chkBackground.Checked)
key.PressBackground(process.MainWindowHandle);
else
key.PressForeground(process.MainWindowHandle);
}
}
catch (Exception ex)
{
Stop();
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} I also just added a Demo for background keypresses...basically this is just making use of the Key object in this library...it works 100%, the background keypresses require the actual hWnd to the Textbox you want text to go in...this might not always be the MainWindowHandle. The easiest way to find out what this is, is to use Spy++ it is built into Visual Studio > Tools > Spy++. Next you need to make your app Build as a x86 app, since x64 background keypresses are next to impossible. |
Thank for your help, I would try it then. Cheers! |
I have created new project using:
The purpose of application is to allow user to send a list of keys at set interval to an active (PressForeground) or background (PressBackground) application.
I have added the Keyboard project to my project. Configured it to build for Any CPU and target .NET 4.0.
I tried to apply PressForeground function first but it doesn't send any key to application. It can call BlueStacks and bring the process to foreground but no key is sent there.
My code example:

Regards,
Khanh Nguyen
The text was updated successfully, but these errors were encountered: