Jump to content

Recommended Posts

Posted

When trying to run this code:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\xoin\My Documents\CMail\gui2.kxf
$Form2 = GUICreate("Cybernations messages - 0.1 Proof of Concept", 1019, 767, -1, -1)
GUISetIcon("C:\Documents and Settings\xoin\My Documents\CMail\icon.ico")
GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form2Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form2Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form2Restore")
$ListView1 = GUICtrlCreateListView("New|Date|From|Subject", 133, 0, 881, 505)
GUICtrlSendMsg(-1, 0x101E, 0, 35)
GUICtrlSendMsg(-1, 0x101E, 1, 135)
GUICtrlSendMsg(-1, 0x101E, 2, 60)
GUICtrlSendMsg(-1, 0x101E, 3, 600)
$ListView1_0 = GUICtrlCreateListViewItem("No|12/22/2007 7:16:15 AM|Ookami| Battle report", $ListView1)
GUICtrlSetOnEvent(-1, "ListView1Click")
$TreeView1 = GUICtrlCreateTreeView(0, 0, 129, 745, BitOR($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS,$TVS_TRACKSELECT,$WS_GROUP,$WS_TABSTOP), $WS_EX_CLIENTEDGE)
$TreeView1_0 = GUICtrlCreateTreeViewItem("Received Messages", $TreeView1)
$TreeView1_1 = GUICtrlCreateTreeViewItem("Sent Messages", $TreeView1)
GUICtrlSetOnEvent(-1, "TreeView1Click")
$Edit1 = GUICtrlCreateEdit("", 136, 512, 881, 233)
GUICtrlSetData(-1, "Edit1")
GUICtrlSetOnEvent(-1, "Edit1Change")
$MenuItem1 = GUICtrlCreateMenu("&Menu")
GUICtrlSetOnEvent(-1, "MenuItem1Click")
$MenuItem4 = GUICtrlCreateMenuItem("&Recieve messages", $MenuItem1)
GUICtrlSetOnEvent(-1, "MenuItem4Click")
$MenuItem5 = GUICtrlCreateMenuItem("&Send messages", $MenuItem1)
GUICtrlSetOnEvent(-1, "MenuItem5Click")
$MenuItem6 = GUICtrlCreateMenuItem("", $MenuItem1)
GUICtrlSetOnEvent(-1, "MenuItem6Click")
$MenuItem7 = GUICtrlCreateMenuItem("&Hide to tray", $MenuItem1)
GUICtrlSetOnEvent(-1, "MenuItem7Click")
$MenuItem8 = GUICtrlCreateMenuItem("&Exit", $MenuItem1)
GUICtrlSetOnEvent(-1, "MenuItem8Click")
$MenuItem2 = GUICtrlCreateMenu("&Settings")
GUICtrlSetOnEvent(-1, "MenuItem2Click")
$MenuItem3 = GUICtrlCreateMenu("&About")
GUICtrlSetOnEvent(-1, "MenuItem3Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(100)
WEnd

Func Edit1Change()

EndFunc
Func Form2Close()
exit
EndFunc
Func Form2Maximize()

EndFunc
Func Form2Minimize()

EndFunc
Func Form2Restore()

EndFunc
Func ListView1Click()
While 1
$msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $ListView1
            $ret = _GUICtrlListGetText ($ListView1, _GUICtrlListSelectedIndex ($ListView1_0))
            If ($ret == $LB_ERR) Then
                MsgBox(16, "Error", "Unknown error from _GUICtrlListGetText")
            Else
                GUICtrlSetData($Edit1, "Item : " & $ret)
            EndIf
    EndSelect
WEnd
EndFunc
Func MenuItem1Click()

EndFunc
Func MenuItem2Click()

EndFunc
Func MenuItem3Click()

EndFunc
Func MenuItem4Click()

EndFunc
Func MenuItem5Click()

EndFunc
Func MenuItem6Click()

EndFunc
Func MenuItem7Click()

EndFunc
Func MenuItem8Click()
exit
EndFunc
Func TreeView1Click()

EndFunc
i keep getting this errors
>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "C:\Documents and Settings\xoin\My Documents\CMail\CMail.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams   
+>22:50:07 Starting AutoIt3Wrapper v.1.9.4
>Running AU3Check (1.54.9.0)  from:C:\Program Files\AutoIt3
C:\Documents and Settings\xoin\My Documents\CMail\CMail.au3(70,99) : ERROR: _GUICtrlListSelectedIndex(): undefined function.
            $ret = _GUICtrlListGetText ($ListView1, string(_GUICtrlListSelectedIndex ($ListView1_0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Documents and Settings\xoin\My Documents\CMail\CMail.au3(70,101) : ERROR: _GUICtrlListGetText(): undefined function.
            $ret = _GUICtrlListGetText ($ListView1, string(_GUICtrlListSelectedIndex ($ListView1_0)))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

^
C:\Documents and Settings\xoin\My Documents\CMail\CMail.au3 - 2 error(s), 0 warning(s)
!>22:50:07 AU3Check ended.rc:2
+>22:50:09 AutoIt3Wrapper Finished
>Exit code: 0   Time: 2.542

Posted

Hi,

1st problem is your using _GUICtrlListGetText () and _GUICtrlListSelectedIndex () functions which are meant for a List (ListBox) control. Yet your control your using is a ListView control

2nd problem is you've not added the #include to the top of your script to use those udf functions.

3 (not so much a problem more a suggestion) update your AutoIt to the current version (v3.2.10.0 current version as of me typing). Reason I'd suggest this is udf functions have been updated/added and udf function names changed.

Also alot more can be done with the current version.

Cheers

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
  • Recently Browsing   0 members

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