Externer Programmrahmen entfernen

  • VB.NET
  • .NET (FX) 4.5–4.8

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von RodFromGermany.

    Externer Programmrahmen entfernen

    Hallöchen liebe Community,
    ich hab da ein kleines Problem.

    Ich binde mithilfe folgendes Codes ein Programm in meine Form ein.

    VB.NET-Quellcode

    1. Imports System.Runtime.InteropServices
    2. Imports System.Threading
    3. <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)>
    4. Public Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
    5. End Function
    6. <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)>
    7. Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
    8. End Function
    9. <DllImport("user32.dll", SetLastError:=True)>
    10. Private Shared Function IsWindowVisible(ByVal hWnd As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
    11. End Function
    12. Private Const WM_SYSCOMMAND As Integer = 274
    13. Private Const SC_MAXIMIZE As Integer = 61488
    14. Private Sub SsC(ByVal Connection As ShellConnection)
    15. Dim tp As New TabPage
    16. tp.Text = Connection.Name
    17. tp.Name = Connection.Hash
    18. TabControl1.TabPages.Add(tp)
    19. Dim proc As New Process
    20. Dim startinf As New ProcessStartInfo
    21. startinf.Arguments = "-ssh " & Connection.IP & " -l " & Connection.User & " -pw " & Connection.PassWd
    22. startinf.FileName = "connector.exe"
    23. proc.StartInfo = startinf
    24. proc.Start()
    25. Thread.Sleep(500)
    26. SetParent(proc.MainWindowHandle, tp.Handle)
    27. SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, IntPtr.Zero)
    28. IsWindowVisible(proc.MainWindowHandle)
    29. End Sub


    Das funktioniert auch soweit wunderbar.
    Nun möchte ich allerdings dass der Border der Software verschwindet. Momentan kann ich das Programm nämlich in meiner Tabpage einfach schließen.

    hat da jemand ne Idee?
    Viele Frauen kamen, viele sind gegangen, eine ist geblieben 12.5.12 <3 ich liebe dich Schatz :love: :love:
    statt

    Linkai schrieb:

    VB.NET-Quellcode

    1. Thread.Sleep(500)
    machst Du

    VB.NET-Quellcode

    1. proc.WaitForInputIdle(500)

    Gugst Du SetWindowLong() (ungetestet).
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!