Sign in to follow this  
Followers 0
Glotar

Is there a way to convert ClassNN to ControlID?

6 posts in this topic

The problem is that I use ControlID values to manage GUIControls in my script, and I need to use ControlGetFocus function. But it returnes ClassNN value and I don't know how to convert it to the ControlID type...

Any suggestions?

Share this post


Link to post
Share on other sites



The problem is that I use ControlID values to manage GUIControls in my script, and I need to use ControlGetFocus function. But it returnes ClassNN value and I don't know how to convert it to the ControlID type...

Any suggestions?

Just use it like this

ControlSend("Untitled - Notepad", "", "[CLASSNN:Edit1]", "This is some text")

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Just use it like this

ControlSend("Untitled - Notepad", "", "[CLASSNN:Edit1]", "This is some text")

Mega

Yes, this way it would act like a ControlID, but I need the exact ControlID value to alter it before I use it in script.

The AutoIT window info can extract both ClassID and ControlID, so isn't there a single way to convert ane to another?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

_WinAPI_GetDlgCtrlID(ControlGetHandle("title", "", "[CLASSNN:Edit1]"))

Although like Mega, I don't understand why can't you do without control ID, and what "alterations" could possibly need to be done on a control ID, lol...

I would just use the handle. Any possible window related function takes handle as a param. Control is a window too.

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites

_WinAPI_GetDlgCtrlID(ControlGetHandle("title", "", "[CLASSNN:Edit1]"))

Although like Mega, I don't understand why can't you do without control ID, and what "alterations" could possibly need to be done on a control ID, lol...

I would just use the handle. Any possible window related function takes handle as a param. Control is a window too.

Thanx! That worked out perfectly!

Number(_WinAPI_GetDlgCtrlID(ControlGetHandle("title", "", "[CLASSNN:Edit1]"))) returnes me the same value I get from the GUICtrlCreateInput function!

I create my own GUI window with lots of controls and some of them are Input controls. I use GUIGetMsg() to find out which one of them got user's attention. But Input control sends message only when it loses focus or when you hit Enter in it, so I can't catch the exact moment when it actually get's focus. I've found ControlGetFocus function which I could use for that purpose, but it returnes only ClassNN kind of value. So, I needed the way to convert it to the ControlID to compare it with known ControlID's of my controls and find out which of them is in focus right now.

Thanks again!

Share this post


Link to post
Share on other sites

Using GuiRegisterMsg to catch EN_SETFOCUS notification would be more efficient.


"be smart, drink your wine"

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