Ontani Posted May 27, 2004 Posted May 27, 2004 Is there a way to send commands from a vb program to an other application that is running. I'm running a game server and i want to send commands from a program i'm making in vb.net to the server. http://ontani.no-ip.com/server_sof.jpg this is the server window. Just an other windows application. Someone told me that i could use DDE [Dynamic Data Exchange] But i don't understand that really Can Someone help me with this one? Greetz From Ontani Quote www.purevision.be :: www.devpoint.be
Administrators PlausiblyDamp Posted May 27, 2004 Administrators Posted May 27, 2004 DDE isn't supported under .Net (as far as I'm aware - but that is a good thing IMHO :)) You may want to look at the ideas in these threads and see if they help any. http://www.xtremedotnettalk.com/showthread.php?t=78598 http://www.xtremedotnettalk.com/showthread.php?t=83630 Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Ontani Posted May 27, 2004 Author Posted May 27, 2004 Private Declare Ansi Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As Int32 Private Const WM_SETTEXT As Integer = &HC Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim hwnd As Integer = FindWindow(vbNullString, "Soldier of Fortune 2 Test Console") '/// assuming you have notepad open. Dim x As Integer = FindWindowEx(hwnd, 0, "Edit", vbNullString) Dim strText As String = "TESTING VB PROGRAM" If Not x = 0 Then SendMessage(x, WM_SETTEXT, 256, strText) End If End Sub This works, i get the text TESTING VB PROGRAM in the server window now it just needs to be entered how do i do that? Greetz Quote www.purevision.be :: www.devpoint.be
Ontani Posted May 28, 2004 Author Posted May 28, 2004 thanx Thanx Guys i found it, just need to add the code SendKeys.Send("{ENTER}") Great thanx Greetz From Ontani Quote www.purevision.be :: www.devpoint.be
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.