Page 1 of 1

Simple way to get window handle?

Posted: Fri Dec 03, 2004 6:10 pm
by marlo
I try to make something in PB to draw,change text,or move things in external window app made by another language,wich is the simple way to get the external window app?

Re: Simple way to get window handle?

Posted: Fri Dec 03, 2004 11:23 pm
by PB
If the other window's title never changes, then you can get its handle like so:

Code: Select all

handle=FindWindow_(0,"FullTitleGoesHere")
And if you need to find it by partial title (rather than full), use this:

Code: Select all

Procedure FindPartialWindow(part$)
  r=GetWindow_(GetDesktopWindow_(),#GW_CHILD)
  Repeat
    t$=space(999) : GetWindowText_(r,t$,999)
    If FindString(t$,part$,1)<>0
      w=r
    Else
      r=GetWindow_(r,#GW_HWNDNEXT)
    EndIf
  Until r=0 Or w<>0
  ProcedureReturn w
EndProcedure

handle=FindPartialWindow("PartialTitleGoesHere")
Fred: Would you perhaps be able to make a native "FindPartialWindow" command?

Posted: Sat Dec 04, 2004 5:33 am
by marlo
Thanks PB!

If the other program call my PB app by parameter as for example
the window handle number can i use the same API command FindWindow?

Another, and last>

How can i ,if is possible , move ,change the text ,of any object in the external window app, if this app send to my PB app the handle number of
that object ,is also possible to do this with PB?

Posted: Sat Dec 04, 2004 6:50 am
by PB
Sorry, but I don't really understand your last 2 questions...?

Posted: Sun Dec 05, 2004 5:24 am
by marlo
Great PB, simply:

I have one app made by another programming language and call
my PB app, then i need that my PB app can use only the Window of
that application ,and the objects in it ,buttons,text,etc, in few word, my PB APP can control and even, if is possible, create or modify objects on external window. I try with APIs but i cant make it work until now.I search
on purearea, and nothing like i want.