get the window handle to other language

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

get the window handle to other language

Post by porfirio »

hi ! i want to know how i use pb functions in oher program windows i search in rhe forum and i found this code:

Code: Select all

handle=FindWindow_(0,"FullTitleGoesHere") 
but i don't know how to use it for exemple i want to create a dll to crate a button in the other program window should i make this :
handle=FindWindow_(0,"FullTitleGoesHere")
If OpenWindow(handle, 364, 175, 600, 300, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "New window ( 0 )")
If CreateGadgetList(WindowID())
ButtonGadget(0, 15, 15, 75, 45, "")

EndIf
EndIf
but that don't work ..

the program that i am using have a function called"window_handle()" many dll i know for this program the ppl when call the dll for crete a window or webgadjet call this function

please help i'm geting frustrated
8O
Forgive-me for my english, i'm portuguese!
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: get the window handle to other language

Post by PB »

What you're asking (adding gadgets to external apps) is very advanced and
not easy to do. I, for example, don't know how to do it -- but nor do I have
any need to. What do you want to do anyway? Maybe there's another way
to do it, without adding gadgets...?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

profram to systray

Post by porfirio »

i want to put the other program in systray hide his window and put a icon on systray and have a comand to show window again
Forgive-me for my english, i'm portuguese!
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

please help

Post by porfirio »

someone know how to do it please help
Forgive-me for my english, i'm portuguese!
Henrik
Enthusiast
Enthusiast
Posts: 404
Joined: Sat Apr 26, 2003 5:08 pm
Location: Denmark

Post by Henrik »

Why not just let your program hide the other prg. and then send your prg. to systray, and from your prg. in systray you can show the other program again on command.

If this does'nt make sens it's because i'm danish 8O
*Edit*
ShowWindow_(Handler,#SW_HIDE)
ShowWindow_(Handler,#SW_SHOW)

Best regrads
Henrik
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

i will try

Post by porfirio »

Henrik wrote:Why not just let your program hide the other prg. and then send your prg. to systray, and from your prg. in systray you can show the other program again on command.

If this does'nt make sens it's because i'm danish 8O
*Edit*
ShowWindow_(Handler,#SW_HIDE)
ShowWindow_(Handler,#SW_SHOW)

Best regrads
Henrik
i will try thanks
Forgive-me for my english, i'm portuguese!
Intrigued
Enthusiast
Enthusiast
Posts: 501
Joined: Thu Jun 02, 2005 3:55 am
Location: U.S.A.

Post by Intrigued »

This topic interests me as well. I have an external application I have created in an application (that uses LUA) that I wanted to do the same thing with as the previous poster is trying to get done.

I have been kicking this around for a couple weeks, but I keep letting myself get sidetrack with all the "chrome" of PB. It's a lot of fun, but one does have their work cut out to make a go of PB. (it's worth it for sure!)

:wink:

[UPDATE]

I did have success tonight besides going blindly into the night. :wink:
Intrigued - Registered PureBasic, lifetime updates user
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

Intrigued wrote:This topic interests me as well. I have an external application I have created in an application (that uses LUA) that I wanted to do the same thing with as the previous poster is trying to get done.

I have been kicking this around for a couple weeks, but I keep letting myself get sidetrack with all the "chrome" of PB. It's a lot of fun, but one does have their work cut out to make a go of PB. (it's worth it for sure!)

:wink:

[UPDATE]

I did have success tonight besides going blindly into the night. :wink:
Somehow i have founded a way to do it ;)
Forgive-me for my english, i'm portuguese!
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: get the window handle to other language

Post by Trond »

PB wrote:What you're asking (adding gadgets to external apps) is very advanced and
not easy to do. I, for example, don't know how to do it -- but nor do I have
any need to. What do you want to do anyway? Maybe there's another way
to do it, without adding gadgets...?
What?? Very advanced?? You must be kidding! When creating a gadget list, you are asked for a window id. If you pass the OS window id of your application (f.ex. made in C/Delphi/etc...) the gadgets will, without problems be created in the other window. What's the problem? (Just disable the debugger.)
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Re: get the window handle to other language

Post by porfirio »

Trond wrote:
PB wrote:What you're asking (adding gadgets to external apps) is very advanced and
not easy to do. I, for example, don't know how to do it -- but nor do I have
any need to. What do you want to do anyway? Maybe there's another way
to do it, without adding gadgets...?
What?? Very advanced?? You must be kidding! When creating a gadget list, you are asked for a window id. If you pass the OS window id of your application (f.ex. made in C/Delphi/etc...) the gadgets will, without problems be created in the other window. What's the problem? (Just disable the debugger.)
That is exacly what i have done!!!
Forgive-me for my english, i'm portuguese!
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: get the window handle to other language

Post by PB »

> What?? Very advanced?? You must be kidding!

Can you please show me how, then? I tried this and it didn't work:

Code: Select all

c=FindWindow_(0,"Calculator")
CreateGadgetList(c)
ButtonGadget(0,0,0,100,20,"test")
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I think your problem is that you don't allow the button draw itself. Actually I haven't found out how to catch events yet, but that shouldn't be impossible.

I'm hard-coding the WindowID for each run:

Code: Select all

WindowID = 13173870

CreateGadgetList(WindowID)
ButtonGadget(0,10,15,60,30,"Test button")

Repeat : WaitWindowEvent()
ForEver
Be sure to close your app using the task manager after finished!!

Another approach would be to make a normal borderless PB window and set it as child of the other window.
porfirio
Enthusiast
Enthusiast
Posts: 111
Joined: Mon Nov 15, 2004 11:00 pm
Location: portugal

Post by porfirio »

i have losted the code but i have made once a code that on mouse click on window it just create a button on it

something like this

CreateGadgetList(GetForegroundWindow_())
ButtonGadget(0,10,15,60,30,"Test button")
Forgive-me for my english, i'm portuguese!
Post Reply