Glotar Posted April 25, 2008 Share Posted April 25, 2008 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? Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 25, 2008 Share Posted April 25, 2008 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 Link to comment Share on other sites More sharing options...
Glotar Posted April 25, 2008 Author Share Posted April 25, 2008 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? Link to comment Share on other sites More sharing options...
Siao Posted April 25, 2008 Share Posted April 25, 2008 (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 April 26, 2008 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Glotar Posted April 28, 2008 Author Share Posted April 28, 2008 _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! Link to comment Share on other sites More sharing options...
Siao Posted April 28, 2008 Share Posted April 28, 2008 Using GuiRegisterMsg to catch EN_SETFOCUS notification would be more efficient. "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now