Valhalla Legends Forums Archive | Visual Basic Programming | process control

AuthorMessageTime
LivedKrad
What I want to accomplish:

1. Locally execute another program. (ShellEx()?).
2. Input mouse clicks and movements into this program. (e.g.: get resolution and pixel dimensions of the remote program so as to precisely move the mouse where I want to and click), (no idea what API will allow this).
3. Monitor the network traffic of this program, specifically to see when certain messages are sent and/or received. (no idea how to do this either).
4. Send keyboard actions to this program.

It would seem to some that I have not researched this, I have. Maybe it would also seem that I have not tried to figure out how to do it, I have. Admittedly, I haven't done much delving into API, but I hope that someone here could help me.

Edit: As of reading a post, I saw something mentioned about Adron's "hooksocket". Would this be able to help me in my endeavour? I've never heard of it.
January 4, 2006, 4:52 AM
FrOzeN
[quote author=LivedKrad.fe link=topic=13773.msg140400#msg140400 date=1136350345]
1. Locally execute another program. (ShellEx()?).
[/quote]
Yes.
[code]Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long[/code]

[quote author=LivedKrad.fe link=topic=13773.msg140400#msg140400 date=1136350345]
3. Monitor the network traffic of this program, specifically to see when certain messages are sent and/or received. (no idea how to do this either).
[/quote]
Look into Hooking onto the program, using SetWindowsHookEx and UnhookWindowsHookEx.
They'll probably be some other API's involved aswell.
[code]Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long

Declare Function UnhookWindowsHookEx Lib "user32" Alias "UnhookWindowsHookEx" (ByVal hHook As Long) As Long[/code]

[quote author=LivedKrad.fe link=topic=13773.msg140400#msg140400 date=1136350345]
4. Send keyboard actions to this program.
[/quote]
Assuming you have gained focus of that program you could probably use SendKeys().

Hope that helps a bit. :)

[EDIT] I just found this for Mouse Input. I was looking into it yesterday to no avail.
http://www.ftponline.com/archives/premier/mgznarch/VBPJ/1999/06jun99/ap0699.pdf
Maybe it will help with #2.
January 4, 2006, 5:06 AM
laurion
perhaps execute an autoit script for #2?
January 4, 2006, 7:02 AM
LoRd
1, 2, & 4 can all be easily acheived through the use of API calls, however Winsock hooking is going to require a great deal of work.  The most common way that I know of (without the use of a third-party library) would be code injection.
January 6, 2006, 7:27 PM
Myndfyr
[quote author=Lord[nK] link=topic=13773.msg140835#msg140835 date=1136575627]
1, 2, & 4 can all be easily acheived through the use of API calls, however Winsock hooking is going to require a great deal of work.  The most common way that I know of (without the use of a third-party library) would be code injection.
[/quote]

It might be easier to just write a network filter driver.
January 8, 2006, 9:01 PM
JoeTheOdd
[quote]3. Monitor the network traffic of this program, specifically to see when certain messages are sent and/or received. (no idea how to do this either).[/quote]

I don't know much about DLL callback functions in Visual Basic, but if you can figure out how to use then, WinPcap is your best friend.
January 8, 2006, 11:18 PM

Search