Correct sendkey for Ctrl + Shift + ; - vb.net

I am trying to sed a keystroke in vb.net, and my code at the moment is SendKeys.Send("+^(;)")
But unfortunately it won't fire, could anyone tell me why?

I don't recommend using sendkeys for anything really. Reason being that you never can guarantee the keystrokes will go where you intend. This is because you are simulating the input as if it were coming from the keyboard, which also ties up your keyboard.
I suggest instead you take the time and learn about the SendMessage api, or the PostMessage api. With these API's you can send messages to specific windows, regardless of what is going on with the keyboard. For instance, if you write a game bot using sendkeys, then you have to leave your computer alone while it runs and hope no unexpected windows pop open. Whereas if you learn the sendmessage api, then you can write a bot that runs in the background while you do other things with your computer.
here are some links to help:
pinvoke - sendmessage api
pinvoke - postmessage api
A list of windows messages constants/hex values/meanings
A nice description on how to use these api's

Related

Awesomium: Control other app like sendmessage

Today I had an idea for a program in vb.net that should add some global hotkeys to Spotify.
I tried to do this with sendmessages, but it didn't work, because Spotify uses Awesomium and so most of the controls aren't Windows-Controls which I can get with sendmessage.
Is there any other possibility to "remoteclick" a button inside the webviewhost?
Or has anyone an other idea how I could click a button in Spotify with my program?
You can do almost anything using AutoIt. Check into that. Lots of game bots are used with it.

Sending keystrokes/mouse clicks to a Java program with Autohotkey

Im trying to send keystrokes and mouse movements to a Java program but once the applicaton has focus nothing is sent. It's as if the Java application takes focus of everything because Autohotkey stops responding. Everything works fine in a regular Windows app (e.g. Notepad).
I've tried using various send methods (Send, SendInput, and SendEvent) but nothing works. Does anyone have any suggestions?
The program in particular is ThinkOrSwim's ThinkDesktop.
I was able to get my script running with ThinkOrSwim by running the SciTE editor as Administrator [or running the compiled scripts as Administrator].
The TOS UI had some refresh issues but my scripts went through fine to do what I needed to do.
Some playing around I've discovered that TOS on Mac OSX can be controlled via scripting with Keyboard Maestro. It's a ugly, hacked solution, but it works. You can edit text boxes and click stuff if you know the X,Y position of elements.
Keyboard Maestro can be run via scripts (AppleScript, Python, etc.) so maybe you can build some elaborate rube goldberg.
I suggest you use Easy Macro Recorder
http://download.cnet.com/Easy-Macro-Recorder/3000-2094_4-10414139.html
Its a great tool to automate keystrokes and mouse movements.
Hope this helps :)

send key strokes to a window in vb.net while it is still minimized

I used to know vb6 and I need to make a quick application. I hope someone can help me with how to send keys to a minimized window in vb.net
thanks
Normally you can send keys with the SendMessage API function, but I'm not sure if it would be affected in any way by the window being minimized, I don't think so but I haven't tried.
To use a Windows API function from VB.Net you need to use PInvoke to call it, you can find information about how to do that on this page.
The MSDN page for SendMessage might also be useful for information about how it works.
Btw, you probably want to use the WM_CHAR message which is 0x0102.
Use SendKeys
http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx
SendKeys.SendWait()

Detecting a message box opened in another application

I am developing a windows service, in VB.NET, that launches a legacy application that performs some work. The service acts as a wrapper around the legacy app allowing users to automate an otherwise manual operation.
Everything is working great, except occasionally the legacy app displays a messagebox. When it does this the process halts until the message box is closed.
As the service will be running on a server there will be no user to close the message box.
The service launches the legacy application in a System.Diagnostics.Process.
Is there way to detect that a message box has been displayed by a process that I have started using System.Diagnostics.Process? And is there a way to close the messagebox through code?
I also found that EnumChildWindows does not return the MessageBox. But I found a site that showed me how to do it. http://vbcity.com/forums/t/105842.aspx
You want to call GetWindow passing in GW_ENABLEDPOPUP. It worked like a charm. Thanks to Scott Waletzko!
Use FindWindow to find the app, the use EnumChildWindows to enumerate all it's childwindows until you find the messagebox (if the messagebox isn't a direct child of the main window of the app you might have to have recursive calls I think).
You might be able to skip the FindWindow call and instead use the MainWindowHandle property of the Process, but I haven't checked if that works.
A good tool for looking at all this is Spy++ which can help you see some information you can get hold of about a running process.

Controlling 3rd party program

Hi my program launches a 3rd party program with a few switches to update itself.
Once these updates are complete I need to manually click save from the applications menu. This can be done via the keyboard (Alt Gr + M then Alt Gr + S)
The application will take several seconds to load at which point the application will open maximised and the save option will be enabled.
Can anyone suggest a method or example for doing such a thing? Monitoring a lauched process? Macro?
Thanks.
I imagine that the most stable way of achieving this is to try to find out which message that is posted to the window when the save command is invoked. Then you can p/invoke SendMessage to send that message to the application window. That way you will not rely on that window being active for the command to be carried out properly.