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

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

Post by porfirio »

how do i embedded a window in other window?

i want to make a litle aplication and i want to make a main window and multy subwindows inside the main window like in many programs i know

if it is possibele please reply and help!!! :D
Last edited by porfirio on Thu Apr 28, 2005 1:55 pm, edited 1 time in total.
Forgive-me for my english, i'm portuguese!
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

You should read up on the MDIGadget()..
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

Pupil wrote:You should read up on the MDIGadget()..

ok thanks :D
Forgive-me for my english, i'm portuguese!
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

OK i get it ;)

but now i want to know if is there a way to get the handle of the window when you run it like

Code: Select all

RunProgram("notepad.exe")
and then embedded it to my window or other things
i have seen some program in internet that with a path to a exe in parameters he run it and send it to systray
i want to do something like that please help me ;) 8)
Forgive-me for my english, i'm portuguese!
goomoo
User
User
Posts: 42
Joined: Sun Dec 05, 2004 9:25 am
Location: China
Contact:

Post by goomoo »

Code: Select all

RunProgram("notepad.exe") 
hWndNotepad=FindWindow_("Notepad",#Null) 
While hWndNotepad=0 
  Delay(100) 
  hWndNotepad=FindWindow_("Notepad",#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_Single) 
; --> Add #WS_CLIPCHILDREN to the ContainerGadget 
SetWindowLong_(hContainer, #GWL_STYLE, GetWindowLong_(hContainer, #GWL_STYLE) | #WS_CLIPCHILDREN) 
; --> Add #WS_CHILD to Notepad 
SetWindowLong_(hWndNotepad, #GWL_STYLE, GetWindowLong_(hWndNotepad, #GWL_STYLE) | #WS_CHILD ! #WS_POPUP) 
; --> Set the ContainerGadget as the parent 
; --> Remove WS_POPUP style, Now Notepad's menu available,and works better!
SetParent_(hWndNotepad,hContainer) 
; --> Position Notepad 
;SetWindowPos_(hWndNotepad, 0, 20, 20, 500, 400, 0) 

Repeat 
  event=WaitWindowEvent() 
Until event=#PB_Event_CloseWindow
Hello, Everyone.
Thanks for your help.
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

goomoo wrote:

Code: Select all

RunProgram("notepad.exe") 
hWndNotepad=FindWindow_("Notepad",#Null) 
While hWndNotepad=0 
  Delay(100) 
  hWndNotepad=FindWindow_("Notepad",#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_Single) 
; --> Add #WS_CLIPCHILDREN to the ContainerGadget 
SetWindowLong_(hContainer, #GWL_STYLE, GetWindowLong_(hContainer, #GWL_STYLE) | #WS_CLIPCHILDREN) 
; --> Add #WS_CHILD to Notepad 
SetWindowLong_(hWndNotepad, #GWL_STYLE, GetWindowLong_(hWndNotepad, #GWL_STYLE) | #WS_CHILD ! #WS_POPUP) 
; --> Set the ContainerGadget as the parent 
; --> Remove WS_POPUP style, Now Notepad's menu available,and works better!
SetParent_(hWndNotepad,hContainer) 
; --> Position Notepad 
;SetWindowPos_(hWndNotepad, 0, 20, 20, 500, 400, 0) 

Repeat 
  event=WaitWindowEvent() 
Until event=#PB_Event_CloseWindow
Thank's man that work good!

But i dont want only notepad i want to be able to get other's programs, even pb programs :?:
Forgive-me for my english, i'm portuguese!
goomoo
User
User
Posts: 42
Joined: Sun Dec 05, 2004 9:25 am
Location: China
Contact:

Post by goomoo »

you can get other app's window handle by it's caption string.
Hello, Everyone.
Thanks for your help.
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

goomoo wrote:you can get other app's window handle by it's caption string.
yeah i know that ....

but if i dont know the caption it will never work :cry:
Forgive-me for my english, i'm portuguese!
ColBoy
Enthusiast
Enthusiast
Posts: 143
Joined: Fri Feb 13, 2004 2:37 pm
Location: Ottawa, Canada
Contact:

Post by ColBoy »

Is it possible to get this to work with DOS apps. It would be great to be able to do this, to implement a method of ensuring the single instance of an app, where I no longer have the source.

I tried doing it, but I just get the DOS app launch in it's own window as normal.

Colin
Colin
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Post by Edwin Knoppert »

forget the whole thing
ColBoy
Enthusiast
Enthusiast
Posts: 143
Joined: Fri Feb 13, 2004 2:37 pm
Location: Ottawa, Canada
Contact:

Post by ColBoy »

I know somthing like this can be done, as I've done it using MultiMediaBuilder.

Colin
Colin
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Colin,

MMB and PB are very different tools. They do things differently, with different results.

MMB uses Activex for embedding applications.

PB can do embedding, but it has to be done low level, like in this flash example:
viewtopic.php?t=11465&highlight=swf

If you really need to do this easily, then stick with MMB.
ColBoy
Enthusiast
Enthusiast
Posts: 143
Joined: Fri Feb 13, 2004 2:37 pm
Location: Ottawa, Canada
Contact:

Post by ColBoy »

OK, that's fine. I'm just the eternal tinkerer, I always like to find new ways to do stuff as it helps to further my understanding.
Colin
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

Ok thank's you all

I am not talked only in Embebded it in window i am talking in get his handle for do somethings with it like hide the taskbar icon or some other things

please try this code

Code: Select all

win.l=runprogram('notepad.exe')
show_message("",str(win))
( i write the code here so mabe there is some spell errors )

and i get "404" always that and if i run mspaint it give me other thing

that's why i have that idea that it can be done

oh well.....

i am so n0000b :(
Forgive-me for my english, i'm portuguese!
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

Maybe this help?
viewtopic.php?t=6753
Post Reply