Jump to content

problem with _GuiCtrlListBox_AddString()?


Recommended Posts

Hi all. I am new to autoit and have the code to a program that creates menus (list boxes) from an ini file. I have tried to modify it, but when I try to create a submenu autoit3.exe throws a fatal exception and crashes. I think the problem may be in the new method for adding items to the list box, which used to be _GuiCtrlListAddItem() and caused the script to not run when I tried it; I changed it to the new method and my app now crashes. Is this a known issue or am I not doing something that is required as of the new version of autoit? The author wrote this in 3, but it must have been an old version because he used that old method for adding items. Any help is greatly appreciated, and let me know if you want code (not sure how I go about doing that). Thanks.

Link to comment
Share on other sites

Hi all. I am new to autoit and have the code to a program that creates menus (list boxes) from an ini file. I have tried to modify it, but when I try to create a submenu autoit3.exe throws a fatal exception and crashes. I think the problem may be in the new method for adding items to the list box, which used to be _GuiCtrlListAddItem() and caused the script to not run when I tried it; I changed it to the new method and my app now crashes. Is this a known issue or am I not doing something that is required as of the new version of autoit? The author wrote this in 3, but it must have been an old version because he used that old method for adding items. Any help is greatly appreciated, and let me know if you want code (not sure how I go about doing that). Thanks.

Link to comment
Share on other sites

either post the code or attach the file.

I've looked back at the old function and compared to the new function name. Have to say not much difference. I don't think your problem stems from that function, but that is just a guess without your code.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I have attached the file. Any comments (or commented code) denoted with a double semicolon are my failed attempts at modifying, but the listbox part of the program is what I modified; I changed that addItem method call and added the begin and end method calls, as well as updating some includes at the beginning of the file. If you run the file, ensure that the ini file (also attached) is in the same directory, and try to open a menu (try the internet menu). You should see the prog crash and an "error reporting" message from Windows. Then again... Apparently you cannot upload ini files, so it will be hard to demonstrate. Also, can anyone tell me why I have to use a separate computer to view replies; the pc I use to post only shows my replies, not those of anyone else, but my braillenote displays them all.

burgeon.au3

Link to comment
Share on other sites

I won't need to look at the code, I have already seen it.

your problem is in the function:

Func read($section, $key, $value = "")
    $read = IniRead($file, $section, $key, $value)
    If @error Then Return $value
    $cmd = Execute($read)

    If @error Then Return $read
    Return $cmd
EndFunc   ;==>read

Not sure exactly what you are trying to accomplish here, but if you pass $value a string with spaces in it autoit crashes.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Far be it from me to argue, but your answer brings up two questions:

1. I am able to create the first listbox with no problems, it crashes after any secondary attempt to create a listbox.

2. I would think spaces are okay; unless the value (the thing that is done when an item in the listbox is selected) is another menu (causing the first problem), the value is run using "Run("cmd.exe start "&$value)". The Run() method and the program crashing on any but the first attempt to create a listbox do not seem related, plus the .exe I got along with this source works fine and I did not touch the function you pointed out, unless something has changed in versions of autoit that will cause the code to now not work, like adding listbox items had to be changed even though the author and myself are using autoit3.

Thanks for your help; as soon as I can get this source to compile then I can make some much-needed additions to it, but as it stands I am stuck here. Next on the list is to use a keystroke, such as ctrl-m, to launch a menu (showMenu()), but that is another post.

Link to comment
Share on other sites

Far be it from me to argue, but your answer brings up two questions:

1. I am able to create the first listbox with no problems, it crashes after any secondary attempt to create a listbox.

2. I would think spaces are okay; unless the value (the thing that is done when an item in the listbox is selected) is another menu (causing the first problem), the value is run using "Run("cmd.exe start "&$value)". The Run() method and the program crashing on any but the first attempt to create a listbox do not seem related, plus the .exe I got along with this source works fine and I did not touch the function you pointed out, unless something has changed in versions of autoit that will cause the code to now not work, like adding listbox items had to be changed even though the author and myself are using autoit3.

Thanks for your help; as soon as I can get this source to compile then I can make some much-needed additions to it, but as it stands I am stuck here. Next on the list is to use a keystroke, such as ctrl-m, to launch a menu (showMenu()), but that is another post.

Post a couple sections of your ini file, without the ini file I can only do a limited test to try to simulate what your saying.

Still if I comment out the "$cmd = Execute($read)" and put in a consolewrite it doesn't bomb.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

The following will create a listbox with the item "internet" in it. Pressing enter on "internet" will open a menu with Firefox, WLM, IE, and Skype in it. (Note that the programs may not actually launch).

[settings]

label=" "

ExitAfterClick=0

;1 would close Burgeon after launching an option

[main]

title="Main Menu"

label="Choose an Option:"

internet Menu=internet_

;note the _ char means look for a section called "internet", so here it is:

[internet]

title="Internet Menu"

label="Choose an option:"

skype=skype:

IE="c:\program" "files\internet" "explorer\iexplore.exe"

Firefox="c:\program" "files\mozilla" "firefox\firefox.exe"

WLM="c:\program" "files\windows" "live\messenger\msnmsgr.exe"

Put the above into "burgeon.ini" in the same dir as the .exe and run the .exe. Try hitting enter (clicks do not work) on the internet menu. If it works, I have no clue how, but it should give you an error from Windows.

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...