Sign in to follow this  
Followers 0
Werty

Getting control handle from ID ?

18 posts in this topic

#1 ·  Posted (edited)

I have a feeling that I'm supposed to be embarrased asking this, but how do I get the ControlHandle from ID instead of INSTANCE ?

This works...

$anger = ControlGetHandle("FaceIt", "", "[CLASS:msctls_trackbar32; INSTANCE:3]")

..but gives me the wrong handle as there are several (many) msctls_trackbars that have INSTANCE:3 (located on different tabs) but they all have different ID: so I need to use the ID: instead but dunno how ;)

This does NOT work, gives me an empty string...

$anger = ControlGetHandle("FaceIt", "", "[CLASS:msctls_trackbar32; ID:1750]")

All the msctls_trackbars are located inside a SysTabControl32.

Thanks in advance :)

Edited by Werty

Share this post


Link to post
Share on other sites



Well, I'm not embarrased anyway since there has been no replies :)

(bump)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I think that is imposible that the same window have the same control with the same class with the same instance.. try to mach the correct window, because that context is imposible.

Anyway if you get the wrong handle then you will get the wrong ID too

Edited by monoscout999

Share this post


Link to post
Share on other sites

They are located inside a SysTabControl32, which have 7 tabs, all tabs contains numerous trackbars (sliders), so it's like, on tab 1 there is a trackbar as INSTANCE:3, tab 2 also have a trackbar as INSTANCE:3, so there are like 7 different trackbars as INSTANCE:3, but located on different tabs.

How do I access the different trackbars on say tab 7 ?

That's where I'm stuck.

I'll post some screenies from AU3Info and ControlViewer later.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

maby your problem is activating tab before you take id or instance?

this is based on sound options on XP located in control panel

Ofc sound options dont have 7 tabs, they have 5

#include <GuiTab.au3>
$anger = ControlGetHandle("Sounds", "", "[CLASS:SysTabControl32]")
If @error Then MsgBox(0,"ERROR",@error)
_GUICtrlTab_SetCurFocus($anger, 6) ;6 = to activate tab number 7, starting enum tab position is 0

try activating tab before takeing handle

Edit: eather way in sound options takeing handle from ID: works 4 me, active tab or not, it dont make diffrance, but maby if you post link to the program that your using and if someone have time he can look directly in the problem.

As for instance using to get handle result is diffrent with activating another tab holding identical CLASS: and INSTANCE:

so activating tab will maby help you

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Thanks, that did it, partially, I had been messing around with _SetCurSel() and couldnt get it working, but _SetCurFocus() works fine, and I get the handle I need. :)

Now the problem is that it doesnt update the 3D view it is controlling, as if it expects a mouse release of some sort.

When dragging the original slider in the program (FaceGen Modeller) it updates a 3D OpenGL viewport live, the model changes as the slider is moved.

That doesnt happen when I update the slider with _GuiCtrlSlider_SetPos(), and GUICtrlSetData doesnt seem to work.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

can you post picture with specific tab and slider marked in paint that you have problems with?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Not much to circle in paint, it's all these sliders, as mentioned when dragged they update the 3D view live, but when I change their value using _GUICtrlSlider_SetPos() the 3D view doesnt update. (edit: the sliders move to the position I tell them to, but the 3D view doesnt update)

Posted Image

Edited by Werty

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

And do the sliders update?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

And do the sliders update?

Yes, you missed my update :)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

i cant grab any controll with info tool, we are probablu using diffrent versions, any chance that i get link from your version?

and the script that your using at the moment?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

i cant grab any controll with info tool, we are probablu using diffrent versions, any chance that i get link from your version?

and the script that your using at the moment?

The info tool cant read them, but Yashied's ControlViewer can.

my script is a bunch of mess right now, I'll post a cleaned up example later.

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Its dumb solution but its working

[autoit]_GUICtrlSlider_SetPos($anger, 20)

ControlSend("","",$anger,"{UP}")[/autoit]

no not working gota think another way

Edit: Btw i totaly missed that info tool in exaqmpel scripts, ty for link man lol

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Its dumb solution but its working

[autoit]_GUICtrlSlider_SetPos($anger, 20)

ControlSend("","",$anger,"{UP}")[/autoit]

no not working gota think another way

Edit: Btw i totaly missed that info tool in exaqmpel scripts, ty for link man lol

lol, works for me ;) so far atleast :)

I have the render window set as child for my Gui, grabbed it with _WinAPI_SetParent().

and yeah, CV.exe is cool. ;)

Edited by Werty

Share this post


Link to post
Share on other sites

$anger = ControlGetHandle("FaceGen", "", "[CLASS:Edit; INSTANCE:1]")
If @error Then MsgBox(0,"ERROR",@error)
ControlSetText("","",$anger,"0.5")
ControlSend("","",$anger,"{ENTER}")

ok heare is working one, instead of slider we will attack edit box and it will work 100% :)


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

$anger = ControlGetHandle("FaceGen", "", "[CLASS:Edit; INSTANCE:1]")
If @error Then MsgBox(0,"ERROR",@error)
ControlSetText("","",$anger,"0.5")
ControlSend("","",$anger,"{ENTER}")

ok heare is working one, instead of slider we will attack edit box and it will work 100% :)

...but that say's DING DING DING all the time, atleast for me ;)

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

well there isnt any other flexible solution for it, that is one crazy slider

but you can try it like this to see if itl work

if its working it shud not reproduce ding or dong

#include <GuiTab.au3>
#Include <GuiSlider.au3>
$anger = ControlGetHandle("FaceGen", "", "[CLASS:msctls_trackbar32; INSTANCE:3]")
_Slider_SetPos($anger,12); ,12) = in %

Func _Slider_SetPos($Hwnd,$pos)
    _GUICtrlSlider_SetPos($Hwnd, $pos)
    Local $a = ControlGetPos("","",$Hwnd)
    $a[2] = ((($a[2] - 14)/100)*$pos)+7
    ControlClick("","",$Hwnd,"",1,$a[2],10)
EndFunc
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

well there isnt any other flexible solution for it, that is one crazy slider

No problem as your example above works just fine for my need :)

Thanks for downloading the program to test, much appreciated ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0