vb.net send string to a different program and get the result - vb.net

I've been developing a .net application for the company I work for, there is just one part I can't seem to do. I need to send a string to a textbox of another program and then copy the result. The result is shown in a label. Currently we hand type the string and manually copy the label text, so I know the information can be copied I just don't know how to do it via code.
The application I need to send the text too is also written with the .net framework if that helps.
Any answers are appreciated :)
Cheers.

You can use native SendMessage() from user32.dll. If you dont know how to import a dll command,
see Platform Invoke Tutorial from MSDN. Once you know how to import a dll command, use FindWindow() to find the window handle of your application and send the string using SendMessage().
The other alternatives is to use socket. Send the message via local network (localhost).
Here's a small tutorial about Socket. Hope this helps :)

Related

Send DDC/CI commands to monitor on Windows using VB.NET?

I'm working on a program to automatically change the brightness of my displays directly using DDC/CI. Currently I'm using ScreenBright's command line arguments to do this just to get things working, but I would like to move to doing it directly now that things are working.
There is a Windows API, the Monitor Configuration API, to do this, but I don't know how to integrate this into my project, and any usage is only given in C++. The only other thing I can find is doing this from Python, which is no use either.
Any help would be much appreciated.

Communicating Between GlovePIE and Application

How can I communicate between VB.net and GlovePIE?
I know that you can send OSC (Open Sound Control-It isn't just for sound) data in GlovePIE so if you could send/receive data in VB.net without any libraries that would work but I cannot find any resources.
Please post any code that you can.
EDIT: All I want is a basic way to communicate between GlovePIE and VB.net and I found that you could send OSC data in GlovePIE but you cannot in VB.net I would accept any help that I can get. If you have a better method, feel free to tell me. I am using this guide to send the data.
After lots of creative thinking, and hours wasted, I finally came up with an idea. (Thanks to spajce for helping me realize there is no perfect solution, and I had to think outside of the box to make this work.) This is what I am going to do. (I have not written the code yet, but I will try to submit it as soon as I write it.)
How I am going to set it up:
I will have a form in VB.net that will send data to the COM port. It's GUI will have the user select the COM port and have a button to connect.
In my GlovePIE script, I will have it automatically hide itself.
For data transfer to VB.net:
GlovePIE will tell if the form is selected using the Window.Title property. If it is, it will emulate a key press. The form will be looking for the keypress.
For Data Transfer to GlovePIE:
The form will change the Me.text property to something that has happened. For exaple, I'm building a robot and if the ping sensor senses something, my Aduino will send the data over serial, to VB.net, which will change the title to "Robot Connect-OBJECT DETECTED" GlovePIE will know the multiple names the form might be, and when searching to see if it is active, it can tell if something has been detected. VB.net will change the title back to "Robot Connect" after GlovePIE signals it has recived the signal.
There will be some bugs, but VB.net is smart enough to tell if another window is the active one. If you are browsing this question, you may have to adapt this. I will have to put a couple of safety features to prevent the robot from not stopping when the VB.net window loses focus.
Thanks to anbody who tried to help.

IAT/EAT hooking "gethostbyname"

I wrote this code to hook API functions by changing the address in the IAT and EAT: http://pastebin.com/7d9N1J2c
This works just fine when I want to hook "recv" or "connect". However for some unknown reason when trying to hook "gethostbyname", my hook function is never called.
I tried to find "gethostbyname" in a debugger by taking the base address of the wsock32.dll module + 0x375e, which is what the ordinal 52 of my wsock32.dll is showing as offset. But that just makes me end up in some random asm code, not at the beginning of a function.
The same method however works fine for trying to find the "recv" entry point.
Does anyone see what I might be doing wrong?
I recommend this tool:
http://www.moduleanalyzer.com/
They do exactly the same and show the url that was connected with that API.
The problem is that there are more than one API to translate an url to an address. The application you are hooking may be using another version of the API that you're not intercepting.
Run some disassembler like IDA and attach to your process after you hook this functions, ida get apply changes on attaching and play process and check what is wrong.
In other way you have many libraries to do hooks with trampolines like Microsoft Detours, NCodeHook etc.

Key logging in .NET

Is it possible to write a key logger in Visual Basic.NET? Is this the right language to be using?
So far, I've gotten a console app to read input and append to a file.
1)How can I make a .NET program "catch" all keyboard input?
2)How do I make a process not show up in Task Manager?
This is not for a virus, but rather a parental control program for a specific clientele. No malicious intent here.
You need to set a Keyboard Hook.
This is extremely difficult and is not possible on 64-bit editions of Windows.
If you're really doing this with consent, this shouldn't be necessary.
Here's a sample of how to write a key logger in .net. http://www.scratchprojects.com/2008/09/csharp_keylogger_p01.php
Your best bet for making it not show up in Task Manager is to make it look like something that belongs. Call it "svchost.exe". :-)

Need to use COMM port 2 to get information from a device. .NET doesnt support it though

I am writing a VB.NET app that has a piece which needs to send a small command to COM port 2 and get the return result. The problem is .NET doesnt have any support for serial communication seems like. Please help.
I just need to send the command "headtype" and get the result.
It certainly does, System.IO.Ports.SerialPort, available since .NET 2.0
Take a look at the SerialPort class.