forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Window Title API call

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Wed Aug 12, 2015 7:31 pm    Post subject: Window Title API call Reply with quote

I am not sure if it is windows 10 or what, but when I use @winactive(N) in a loop, my app stops responding and crashes after a few min. I really need to get the title of windows. Is there an API call that I can use to get the title bar text of a window?
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Wed Aug 12, 2015 8:44 pm    Post subject: Reply with quote

ok I think I can use the WM_GETTEXT with @sendmsg() but it only returns the length of the text, not the text itself. It copies the text to a buffer.... I can figure out how to get it from the buffer... Neutral
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Aug 12, 2015 10:50 pm    Post subject: Reply with quote

Are you checking @winactive(n) for null state?
Back to top
View user's profile Send private message AIM Address
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Wed Aug 12, 2015 10:52 pm    Post subject: Reply with quote

Yeah. I don't get an error or anything, the app just hangs. If I remove the check for the title name @winactive(n) it works fine.
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Aug 12, 2015 10:55 pm    Post subject: Reply with quote

Code:

DIALOG CREATE,New Dialog,-1,0,240,160,,ontop
REM *** Modified by Dialog Designer on 8/12/2015 - 17:54 ***
  DIALOG SHOW

:loop
if @event()
stop
end
%x = @winactive(n)
if @null(%x)
%x = not available
end
dialog title,%x
goto loop


Compiling and testing the above for the evening. VDS5. I'll let you know if it hangs
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Aug 12, 2015 10:58 pm    Post subject: Reply with quote

No need to test for an evening. Already have an app hang. I'll let you know what I find.

I'm thinking that if we place a delay, a wait in there maybe the hang won't occur. It likely has to do with window switching though, the moment where the active window handle changes. In that case you can't really fully prevent the problem, you would only be able to mitigate it by delay looping.
Back to top
View user's profile Send private message AIM Address
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Wed Aug 12, 2015 11:05 pm    Post subject: Reply with quote

I already have a delay. I have tested 0.1 to 1 second. I can't have it longer than that. 1 second is pushing it. I am going to try doing a winlist and then see if I can match the class name in that list to get the title.
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Aug 12, 2015 11:46 pm    Post subject: Reply with quote

This gets it.

Code:

DIALOG CREATE,New Dialog,-1,0,240,160,,ontop
REM *** Modified by Dialog Designer on 8/12/2015 - 17:54 ***
  DIALOG SHOW

:loop
if @event()
stop
end
%x = @winactive(c)
# info %x
if @null(%x)
%x = TVDSDialog
end
wait .1
if @wintext(#%x)
dialog title,@wintext(#%x)
end
goto loop
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Aug 12, 2015 11:47 pm    Post subject: Reply with quote

I think the wait .1 is unneeded.
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Aug 12, 2015 11:48 pm    Post subject: Reply with quote

Code:
DIALOG CREATE,New Dialog,-1,0,240,160,,ontop
REM *** Modified by Dialog Designer on 8/12/2015 - 17:54 ***
  DIALOG SHOW

:loop
if @event()
stop
end
%x = @winactive(c)
# info %x
if @null(%x)
%x = TVDSDialog
end
if @wintext(#%x)
dialog title,@wintext(#%x)
end
goto loop


This seems to work. Testing more thoroughly.
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Aug 12, 2015 11:50 pm    Post subject: Reply with quote

*crash* didn't work
Back to top
View user's profile Send private message AIM Address
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Wed Aug 12, 2015 11:53 pm    Post subject: Reply with quote

So it didn't work at all or needs the 0.1?

So far, mine is working ok.

I made the following function and it is working to get the title

Code:

:WinTitle
  %%exit =
  %t = @new(list)
  list winlist,%t,CN
  %x = 0
  repeat
    parse "%a;%b",@item(%t,%x)
    if @equal(%a,%1)
      if %b
        %%exit = @trim(%b)
        %x = @pred(@count(%t))
      end
    end
    %x = @succ(%x)
  until @equal(%x,@count(%t))
  list close,%t
  exit %%exit

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Wed Aug 12, 2015 11:56 pm    Post subject: Reply with quote

Nope, mine wasn't working at all. I was getting ready to go back to your original API suggestion, with loading and unloading the DLL after each call after sorting out how to make the call at all.

I'll test your function over here as well.
Back to top
View user's profile Send private message AIM Address
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 762
Location: Rockeledge, GA

PostPosted: Thu Aug 13, 2015 12:09 am    Post subject: Reply with quote

Seems to work! Good job!
Back to top
View user's profile Send private message AIM Address
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1751
Location: Space and Time

PostPosted: Thu Aug 13, 2015 12:10 am    Post subject: Reply with quote

Yep! I'm happy with it! It was kicking my ass all day Smile I have had my app running for about 15 min now, no crash. Smile

Thanks

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group