|
-
Mar 25th, 2000, 01:00 AM
#1
Thread Starter
Hyperactive Member
Hi,
Is there any way I can open an App into a form of my VB.exe? At present I open the App by clicking a command button. The App is in a fixed location.
I use this code:
Private Sub CmdAnimations_Click()
Dim shellProgram As String
Dim res
shellProgram = App.Path & "\Part 1\cycling.exe"
res = Shell(shellProgram, vbNormalFocus)
End Sub
I was hoping that, instead of opening the App and having it running outside my VB program, I could have it running somewhere in my form. Is this possible?
Any help would be greatly appreciated!
-
Mar 25th, 2000, 02:07 AM
#2
Lively Member
Hope this helps
Hello,
Here is some code that might help you, personnaly I think if you're gonna do this sort of thing then you should load the program into a MDI program instead of an SDI program.
Code:
Option Explicit
'//API CALLS NEEDED
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
'//CONSTANT NEEDED TO SHOW NOTEPAD
Const SW_SHOW = 5
'//THE HWND FOR NOTEPAD
Dim lNotepad As Long
Private Sub Command1_Click() '//OPENS NOTEPAD INTO YOUR FORM
Shell "c:\windows\notepad.exe", vbHide '//SHELLS A HIDDEN NOTEPAD
lNotepad = FindWindow("Notepad", vbNullString) '//GETS THE HWND OF NOTEPAD
SetParent lNotepad, Me.hwnd '//SETS NOTEPADS PARENT FROM THE DESKTOP TO YOUR APP
ShowWindow lNotepad, SW_SHOW '//SHOWS NOTEPAD
End Sub
Private Sub Command2_Click() '// RETURNS NOTEPAD BACK TO THE DESKTOP
Dim lDesktop As Long
lDesktop = GetDesktopWindow '//GETS THE HWND OF THE DESKTOP
SetParent lNotepad, lDesktop '//SETS NOTEPADS PARENT BACK TO THE DESKTOP
End Sub
-
May 18th, 2000, 09:56 AM
#3
Member
why not just use an OLE box????
it would be alot simpler doing it that way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|