Third party aplication controll RRS feed

  • Question

  • I will keep it simple... I need to be able to open internet explorer in full screen from my program. I have already found out how to open it     process.start("")   but i need to know how i can control third party aplications.

    continuation... I saw a video of someone with a program that was for phidgets ( phisical interface) and he could select and control a button in any program and control it with a physical button. I wil post a link to the video later. please help

    any response would be apreciated.



    Monday, September 4, 2006 2:23 PM

All replies

  • It is possible with win32 api :
    Declaration :

    <System.Runtime.InteropServices.DllImport("user32.dll", _
    ExactSpelling:=True, _
    CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _
    Private Shared Function SetWindowPos( _
    ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, _
    ByVal x As Integer, ByVal y As Integer, _
    ByVal cx As Integer, ByVal cy As Integer, _
    ByVal flags As Integer) As Boolean
    End Function


    Private Const SWP_NOSIZE As Integer = &H1
    Private Const SWP_NOMOVE As Integer = &H2
    Private Const SWP_NOZORDER As Integer = &H4
    Private Const SWP_NOREDRAW As Integer = &H8
    Private Const SWP_NOACTIVATE As Integer = &H10
    Private Const SWP_FRAMECHANGED As Integer = &H20
    Private Const SWP_SHOWWINDOW As Integer = &H40
    Private Const SWP_HIDEWINDOW As Integer = &H80
    Private Const SWP_NOCOPYBITS As Integer = &H100
    Private Const SWP_NOOWNERZORDER As Integer = &H200
    Private Const SWP_NOSENDCHANGING As Integer = &H400
    Private Const SWP_DRAWFRAME As Integer = &H20
    Private Const SWP_NOREPOSITION As Integer = &H200
    Private Const SWP_DEFERERASE As Integer = &H2000
    Private Const SWP_ASYNCWINDOWPOS As Integer = &H4000

    Using :

    SetWindowPos(YourProc.MainWindowHandle, IntPtr.Zero, _
    0, 0, 800, 600, SWP_SHOWWINDOW)

    (You can use SetWindowPlacement function as well)

    For more control read about other api functions. http://www.allapi.net/agnet/apiguide.shtml - here is guide with examples. It is for VB6, but using in NET is the same, only declaration is difrent.

    If you want control single form controls, You must find their handles. You can use MS Spy++ (screen on link below) or EnumChildWindows API function.

    MS Spy++ : http://ww1.pureupload.com/public/25104/example.JPG?no_history

    Monday, September 4, 2006 7:37 PM
  • thanks alot this will work great after I can get spy++ running.

    thanks so much


    Monday, September 4, 2006 9:37 PM
  • alternative to spy++ is -


    And look into the "sendkeys" class -

    ' Get a handle to an application window.
    Declare Auto Function FindWindow Lib "USER32.DLL" ( _
        ByVal lpClassName As String, _
        ByVal lpWindowName As String) As IntPtr

    ' Activate an application window.
    Declare Auto Function SetForegroundWindow Lib "USER32.DLL" _
        (ByVal hWnd As IntPtr) As Boolean

    ' Send a series of key presses to the Calculator application.
    Private Sub button1_Click(ByVal sender As Object, _
        ByVal e As EventArgs) Handles button1.Click

        ' Get a handle to the Calculator application. The window class
        ' and window name were obtained using the Spy++ tool.
        Dim calculatorHandle As IntPtr = FindWindow("SciCalc", "Calculator")

        ' Verify that Calculator is a running process.
        If calculatorHandle = IntPtr.Zero Then
            MsgBox("Calculator is not running.")
        End If

        ' Make Calculator the foreground application and send it
        ' a set of calculations.
    End Sub


    Wednesday, September 6, 2006 11:01 PM