*.exe Datei in einem MDI Formular öffnen.
lima-city → Forum → Programmiersprachen → Basic
anwendung
bestimmen
erachten
fenster
festlegen
feststelle
form
formular
http
jemand
nachsehen
pause
pixel
schnelle hilfe
setzen
shell
single
starten
string
tip
-
Hi,
ich wollte mal fragen ob jemand wei?, wie man eine *.exe Datei in einem MDI Formular startet. Diese Anwendung soll nur im Ramen eines MDI Formular bleiben. Man kann zwar die Anwendungen auch au?erhalb eines MDI Formulars starten, doch sie sollen prim?r im MDI Formular ausgef?hrt werden, also sogesehen indirekt als MDIChild Formular.
Ich hoffe auf schnelle Hilfe von euch. Bitte falls jemand eine L?sung in Form eines Quelltextes hat, dann k?nnt ihr mir diesen per E-Mail zusenden.
MfG freewareecke -
Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!
lima-city: Gratis werbefreier Webspace für deine eigene Homepage
-
Hi,
Ich weiss jetzt nicht ob das geht, aber es gibt da die M?glichkeit eine EXE-Datein in ein normales Form einzubinden:
Ben?tigt: 1 Form; 2 Command Buttons
------------------------------------------------------------------------------------------------------
Option Explicit
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, _
ByVal X As Long, ByVal y As Long, ByVal nWidth As Long, _
ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" ( _
ByVal hwnd As Long, ByVal lpString As String) As Long
Private Declare Function GetDeskTopWindow Lib "user32" _
Alias "GetDesktopWindow" () As Long
Private lhwnd As Long
Private ret As Long
Private Sub Command1_Click()
Dim ltop As Long
Dim lleft As Long
Dim lwidth As Long
Dim lheight As Long
' Notepad starten
Call Shell("notepad", vbHide)
' Warten bis vollstaendig geladen
Call pause(0.2)
' Handle des neuen Notepad-Fensters feststellen
lhwnd = FindWindow("Notepad", vbNullString)
If lhwnd <> 0 Then
Command1.Enabled = False
Command2.Enabled = True
' Jetzt wird das Fenster geklaut
Call SetParent(lhwnd, Me.hwnd)
' Ausmasse festlegen (Scalemode von Form1 muss Pixel sein)
ltop = Command1.Top + Command1.Height
lleft = 0
lwidth = Me.ScaleWidth
lheight = Me.ScaleHeight - ltop
' Neue Ausmasse setzen
Call MoveWindow(lhwnd, lleft, ltop, lwidth, lheight, 1)
' Caption zuweisen
ret = SetWindowText(lhwnd, "Kidnapped Notepad")
' Sichtbar machen
ret = ShowWindow(lhwnd, 1)
End If
End Sub
Sub pause(ByVal pause As Single)
Dim t As Single
t = Timer
Do
DoEvents
Loop Until (Timer - t) >= pause
End Sub
Private Sub Command2_Click()
Dim dh As Long
' Handle des Desktop bestimmen
dh = GetDeskTopWindow()
' Programm wieder in den Desktop setzen.
Call SetParent(lhwnd, dh)
Command1.Enabled = True
Command2.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call Command2_Click
End Sub
--------------------------------------------------------------------------------------------------
Quelle: www.ActiveVB.de
Und als Donwload: http://www.activevb.de/tipps/downloads/tipp0489.zip
mfg Lukas -
Diskutiere mit und stelle Fragen: Jetzt kostenlos anmelden!
lima-city: Gratis werbefreier Webspace für deine eigene Homepage