run another exe file in window of main programm?
-
SeregaZ
- Enthusiast

- Posts: 628
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
run another exe file in window of main programm?
it is passible? i mean launch some external exe file in window of my programm, like web site runing in webgadjet, or like virtual mashines do.
Re: run another exe file in window of main programm?
Have you already taken a look into the example codes from srod and gnozal which embed
the calculator into their own window?
http://www.purebasic.fr/english/viewtop ... 74&start=4
http://www.purebasic.fr/english/viewtop ... 73&start=9
the calculator into their own window?
http://www.purebasic.fr/english/viewtop ... 74&start=4
http://www.purebasic.fr/english/viewtop ... 73&start=9
-
SeregaZ
- Enthusiast

- Posts: 628
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: run another exe file in window of main programm?
ouch... search request wrong...
-
SeregaZ
- Enthusiast

- Posts: 628
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: run another exe file in window of main programm?
i use this code:
and i have one small problem. when i open a few windows and switch between them by directly clicking on inside programm - my main window still not active and can be stay behind of another window.

who can advice in this case?
Code: Select all
#APPNAME1 = "Calculator"
Define *Parent
Global *Child
Procedure MyWindowCallback(hWnd, uMsg, wParam, lParam)
result = #PB_ProcessPureBasicEvents
Select uMsg
Case #WM_PAINT
RedrawWindow_(*Child, 0, 0, #RDW_INVALIDATE|#RDW_ERASE|#RDW_FRAME)
EndSelect
ProcedureReturn Result
EndProcedure
*Child = FindWindow_(0, #APPNAME1)
If Not *Child
RunProgram("calc.exe") : Delay(1000)
*Child = FindWindow_(0, #APPNAME1)
If Not *Child
MessageRequester("Error", #APPNAME1 + " must be running !")
End
EndIf
EndIf
*Parent = OpenWindow(0, 0, 0, 320, 240, "Master", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget)
If *Parent
SetWindowColor(0, $AAAAAA)
CreateStatusBar(0, WindowID(0))
SetParent_(*Child, WindowID(0))
SetWindowPos_(*Child, 0, 0, 0, 0, 0, #SWP_NOSIZE | #SWP_SHOWWINDOW)
SetWindowCallback(@MyWindowCallback())
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
If IsWindow_(*Child)
SetParent_(*Child, 0)
EndIf
CloseWindow(0)
Break
EndSelect
ForEver
EndIf
End
who can advice in this case?
