run a program and get his handle to embedded in my window

Just starting out? Need help? Post your questions and find answers here.
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

Pupil wrote:Maybe this help?
viewtopic.php?t=6753
Wow, very cooool!!!

thank's ;)
Forgive-me for my english, i'm portuguese!
Truth_Seeker
Enthusiast
Enthusiast
Posts: 145
Joined: Tue Mar 01, 2005 8:41 pm
Location: Near a Computer

Post by Truth_Seeker »

Edwin Knoppert wrote:forget the whole thing
Just curious but why do you say to forget the whole thing? I mean I think it is intresting that you can embed another application in yours.
Thanks
Truth Seeker
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

Truth_Seeker wrote:
Edwin Knoppert wrote:forget the whole thing
Just curious but why do you say to forget the whole thing? I mean I think it is intresting that you can embed another application in yours.
yes your right ;)

opk i know how to get the handle and now i want to know hot to put it in my mdigadgect, setparent_(win,win) work but i want it in mdi so it will have scrollbar and he could be maximizated inside the window....

so if someone know how do i add the opened window in my mdi i will apreciate ;)
Forgive-me for my english, i'm portuguese!
Truth_Seeker
Enthusiast
Enthusiast
Posts: 145
Joined: Tue Mar 01, 2005 8:41 pm
Location: Near a Computer

Post by Truth_Seeker »

By the way is it legal to sell an application that embeds another?
Thanks
Truth Seeker
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

Truth_Seeker wrote:By the way is it legal to sell an application that embeds another?
it depends of the aplication you want to use i think....

[edit]

by the way i buy a aplication for my store that costs 500€ and it embeds calc.exe so...
Forgive-me for my english, i'm portuguese!
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Post by Edwin Knoppert »

It's not an issue if it's nice, it's an issue you simply can't.
Of course maybe the notepad window is embedded but that would behave very poorly.
All kinds of things conflict.

My recomendation if you want to pursuit?
Try to move the window's position along with desired location.
This is somehow of an embedded windows media viewer behavious.
Drag while playing and you'll notice the video is kept behind.
It's just an idea.
Not parent window stuff but more a stay above window matter.
Still seperated from the app controlling it.
Truth_Seeker
Enthusiast
Enthusiast
Posts: 145
Joined: Tue Mar 01, 2005 8:41 pm
Location: Near a Computer

Post by Truth_Seeker »

This code:

Code: Select all

RunProgram("c:\Program Files\Windows Media Player\wmplayer.exe") 
hWndApp=FindWindow_("WMPlayerApp" , #Null)
While hWndApp=0 
  Delay(100) 
  hWndApp=FindWindow_("WMPlayerApp" , #Null) 
Wend 

hwndMain=OpenWindow(1,0,0,640,480,#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget,"Containt Notepad") 
If hwndMain=0 
  End 
EndIf 
CreateGadgetList(hwndMain) 
hContainer=ContainerGadget(1,3,3,636,470,#PB_Container_BorderLess) 
; --> Add #WS_CLIPCHILDREN to the ContainerGadget 
SetWindowLong_(hContainer, #GWL_STYLE, GetWindowLong_(hContainer, #GWL_STYLE) | #WS_CLIPCHILDREN) 
; --> Add #WS_CHILD to the APP 
SetWindowLong_(hWndApp, #GWL_STYLE, GetWindowLong_(hWndApp, #GWL_STYLE) | #WS_CHILD ! #WS_POPUP) 
; --> Set the ContainerGadget as the parent 
; --> Remove WS_POPUP style, Now App's menu available,and works better! 
SetParent_(hWndApp,hContainer) 
; --> Position Notepad 
;SetWindowPos_(hWndApp, 0, 20, 20, 500, 400, 0) 
ShowWindow_(hWndApp,#SW_SHOWMAXIMIZED)

Repeat 
  event=WindowEvent()
  Delay(10)
Until event=#PB_Event_CloseWindow

SendMessage_(hWndApp, #WM_CLOSE, #Null, #Null)
End
Works for me as long as I do not minimize and restore the window. Movie shows just like normal even if you move the window around. Maybe I am not understanding or something...
Thanks
Truth Seeker
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

Truth_Seeker wrote:This code:

Code: Select all

RunProgram("c:\Program Files\Windows Media Player\wmplayer.exe") 
hWndApp=FindWindow_("WMPlayerApp" , #Null)
While hWndApp=0 
  Delay(100) 
  hWndApp=FindWindow_("WMPlayerApp" , #Null) 
Wend 

hwndMain=OpenWindow(1,0,0,640,480,#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget,"Containt Notepad") 
If hwndMain=0 
  End 
EndIf 
CreateGadgetList(hwndMain) 
hContainer=ContainerGadget(1,3,3,636,470,#PB_Container_BorderLess) 
; --> Add #WS_CLIPCHILDREN to the ContainerGadget 
SetWindowLong_(hContainer, #GWL_STYLE, GetWindowLong_(hContainer, #GWL_STYLE) | #WS_CLIPCHILDREN) 
; --> Add #WS_CHILD to the APP 
SetWindowLong_(hWndApp, #GWL_STYLE, GetWindowLong_(hWndApp, #GWL_STYLE) | #WS_CHILD ! #WS_POPUP) 
; --> Set the ContainerGadget as the parent 
; --> Remove WS_POPUP style, Now App's menu available,and works better! 
SetParent_(hWndApp,hContainer) 
; --> Position Notepad 
;SetWindowPos_(hWndApp, 0, 20, 20, 500, 400, 0) 
ShowWindow_(hWndApp,#SW_SHOWMAXIMIZED)

Repeat 
  event=WindowEvent()
  Delay(10)
Until event=#PB_Event_CloseWindow

SendMessage_(hWndApp, #WM_CLOSE, #Null, #Null)
End
Works for me as long as I do not minimize and restore the window. Movie shows just like normal even if you move the window around. Maybe I am not understanding or something...
It work but i was talking in mdi....
Forgive-me for my english, i'm portuguese!
Truth_Seeker
Enthusiast
Enthusiast
Posts: 145
Joined: Tue Mar 01, 2005 8:41 pm
Location: Near a Computer

Post by Truth_Seeker »

@Porfirio: sorry I was trying to see what Edwin was talking about.
Thanks
Truth Seeker
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

Truth_Seeker wrote:@Porfirio: sorry I was trying to see what Edwin was talking about.
ok no problem ;)

but i still dont get my window in mdi :(
Forgive-me for my english, i'm portuguese!
Truth_Seeker
Enthusiast
Enthusiast
Posts: 145
Joined: Tue Mar 01, 2005 8:41 pm
Location: Near a Computer

Post by Truth_Seeker »

I do get a refresh problem and other problems when trying it inside a MDI, it probably could be fixed if you knew how to repaint the child window and the embed application. But I dont know enough winapi.
Thanks
Truth Seeker
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

Truth_Seeker wrote:I do get a refresh problem and other problems when trying it inside a MDI, it probably could be fixed if you knew how to repaint the child window and the embed application. But I dont know enough winapi.
ok .....

glad you try ;)
Forgive-me for my english, i'm portuguese!
zikitrake
Addict
Addict
Posts: 868
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

Truth_Seeker wrote:This code:

Code: Select all

RunProgram("c:\Program Files\Windows Media Player\wmplayer.exe") 
hWndApp=FindWindow_("WMPlayerApp" , #Null)
While hWndApp=0 
  Delay(100) 
  hWndApp=FindWindow_("WMPlayerApp" , #Null) 
Wend 

hwndMain=OpenWindow(1,0,0,640,480,#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget,"Containt Notepad") 
If hwndMain=0 
  End 
EndIf 
CreateGadgetList(hwndMain) 
hContainer=ContainerGadget(1,3,3,636,470,#PB_Container_BorderLess) 
; --> Add #WS_CLIPCHILDREN to the ContainerGadget 
SetWindowLong_(hContainer, #GWL_STYLE, GetWindowLong_(hContainer, #GWL_STYLE) | #WS_CLIPCHILDREN) 
; --> Add #WS_CHILD to the APP 
SetWindowLong_(hWndApp, #GWL_STYLE, GetWindowLong_(hWndApp, #GWL_STYLE) | #WS_CHILD ! #WS_POPUP) 
; --> Set the ContainerGadget as the parent 
; --> Remove WS_POPUP style, Now App's menu available,and works better! 
SetParent_(hWndApp,hContainer) 
; --> Position Notepad 
;SetWindowPos_(hWndApp, 0, 20, 20, 500, 400, 0) 
ShowWindow_(hWndApp,#SW_SHOWMAXIMIZED)

Repeat 
  event=WindowEvent()
  Delay(10)
Until event=#PB_Event_CloseWindow

SendMessage_(hWndApp, #WM_CLOSE, #Null, #Null)
End
Works for me as long as I do not minimize and restore the window. Movie shows just like normal even if you move the window around. Maybe I am not understanding or something...
There is some way to see only the video? (Without menu, without list of reproduction. ..)

Thank you!
PB 6.21 beta, PureVision User
Post Reply