Jump to content

OnEvent when something shows up in a ListBox


CountyIT
 Share

Recommended Posts

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

GUIRegisterMsg($WM_CLOSE, "WM_CLOSE")

You should give a try to WM_COPYDATA, if you read Msdn, its for the purpose you are searching for :huh:

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Check Guinness's signature for WM_COPYDATA example...

Edit : here is the link

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Seeing as how you've gotten the text to show up in Script 2's listbox, perhaps this script could be modified to your needs to let you know when the text in the listbox has changed, specifically the part where the script is using WM_COMMAND and monitoring the EN_CHANGE message to see if something has changed.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I don't know if you want to step in the middlw of this one or not. I have already been chastised for not using WM_COPYDATA :) It is kind of interesting though. I have a GUI on the main program that is hidden because there is really no user interaction with it. My intent was to send commands to it via SendMessage() to more or less control the program remotely. The two functions I (use to) register were:

GUIRegisterMsg($WM_CLOSE, "WM_CLOSE")

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

and what I would do from the second script was:

_SendMessage($WindowHandle, $WM_CLOSE, 0, 0)

_SendMessage($WindowHandle, $WM_COMMAND, 0, 0)

The _SendMessage($WindowHandle, $WM_CLOSE, 0, 0) worked without fail. The correct function on the first script ("WM_COLSE") executed. The _SendMessage($WindowHandle, $WM_COMMAND, 0, 0) would not work. The function on the first script never executed. I tried several other commands in place of WM_COMMAND and nada.

Finally, in a drunk stupor, I thought I would try something a little closer to WM_CLOSE in the list of commands in WindowsConstants.gui so I choose WM_ENABLE. It worked. I got away from it at that point. I figure either certain commands can't be sent with _SendMessage() or certain commands can't be registered with GUIRegisterMsg(). Don't know but WM_ENABLE seemed to work where many other did not...

Link to comment
Share on other sites

You stated that you were able to update the text in the listbox, the code I pointed you to (although it's using an input control) will read that the input control has been changed and reacts to that change with the $WM_COMMAND function, and then further reacts to that change by looking at the EN_CHANGE message.

That script would work with the GUI that has your listbox, so all you have to do is update the text in the listbox, watch for any messages from that listbox using WM_COMMAND, and then doing something if that message is a E_CHANGE message. All of this is done in the script that creates the GUI with the listbox.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...