However, to get your re-painting working better, use #WM_PAINT in a callback - it's far better than the PB event when moving the window etc. Also, a slight modification to the RedrawWinwdow_() flags is required.
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