I need help with vb.net make admintool

12/07/2013 12:57 hassuny#1
HI guys how are you ?

anyone can help me with code send comand to PrincessAuroraServer

sorry for my eng anyone uderstand me I want this code in visualBaisc
12/07/2013 20:52 marekrndr#2
You can do some reading from the MSDN from here - [Only registered and activated users can see links. Click Here To Register...]

The method posted below should be working accordingly, I did not test it, just wrote it down here.

Code:
Public Declare Function apiBlockInput Lib "user32" Alias "BlockInput" (ByVal fBlock As Integer) As Integer

Public Sub Send2Aurora(Byval Input As String)
        Try
                Dim procArray() As System.Diagnostics.Process
                Dim proc As System.Diagnostics.Process

                procArray = System.Diagnostics.Process.GetProcessesByName("PrincessAuroraServer")
                        
                     If procArray.Length > 0 Then
                                proc = procArray(0)
                                ShowWindow(proc.MainWindowHandle, SW_RESTORE)
                                apiBlockInput(1)
                                SendKeys.SendWait(Input)
                                Thread.Sleep(500)
                                SendKeys.SendWait("{ENTER}")
                    End If

        Catch ex As Exception
                Msgbox(ex.Message)
        Finally
                apiBlockInput(0)
        End Try
End Sub
12/08/2013 18:38 Guibzs#3
Quote:
Originally Posted by marekrndr View Post
You can do some reading from the MSDN from here - [Only registered and activated users can see links. Click Here To Register...]

The method posted below should be working accordingly, I did not test it, just wrote it down here.

Code:
Public Declare Function apiBlockInput Lib "user32" Alias "BlockInput" (ByVal fBlock As Integer) As Integer

Public Sub Send2Aurora(Byval Input As String)
        Try
                Dim procArray() As System.Diagnostics.Process
                Dim proc As System.Diagnostics.Process

                procArray = System.Diagnostics.Process.GetProcessesByName("PrincessAuroraServer")
                        
                     If procArray.Length > 0 Then
                                proc = procArray(0)
                                ShowWindow(proc.MainWindowHandle, SW_RESTORE)
                                apiBlockInput(1)
                                SendKeys.SendWait(Input)
                                Thread.Sleep(500)
                                SendKeys.SendWait("{ENTER}")
                    End If

        Catch ex As Exception
                Msgbox(ex.Message)
        Finally
                BlockInput(0)
        End Try
End Sub
Stop me if I'm wrong, but I think this method put the PrincessAurora foreground.
12/08/2013 19:34 hassuny#4
pleas help me I have this code. but when I send the command "start_service"
Appears as ؟؟؟؟؟؟؟؟؟؟؟؟؟ in PrincessAurora

and this is the code

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim process As Process
For Each process In process.GetProcessesByName("PrincessAuroraServer")
Dim p As IntPtr = Marshal.StringToHGlobalAuto("start_service")
Dim tmp As IntPtr = FindWindowEx(process.MainWindowHandle, IntPtr.Zero, "Edit", vbNullString)
Dim r As IntPtr = New IntPtr("start_service".Length)
SendMessage(tmp, WM_SETTEXT, p, r)

SendMessage(tmp, 258, 13, IntPtr.Zero)
Application.DoEvents()

Next
End Sub
12/08/2013 19:43 marekrndr#5
Quote:
Originally Posted by Guibzs View Post
Stop me if I'm wrong, but I think this method put the PrincessAurora foreground.
Yes.. It puts the auth server in foreground and sends keystrokes to it. It's the most simple method to do - I don't see how would be providing hassuny with a more complex code be any more productive because he clearly can't even understand this one.

Quote:
Originally Posted by hassuny View Post
pleas help me I have this code. but when I send the command "start_service"
I don't see a reason why you are not using the code I provided you with.
12/08/2013 20:26 hassuny#6
but where can i put the command "start_service"
12/09/2013 12:08 marekrndr#7
You can assign it to an event, like a Button1.Click, with Send2Aurora("start_service")