本帖最后由 qsy666888 于 2020-6-5 23:02 编辑
保存在数据库中的代码 现在点击后只能读取 我想点击后运行这段代码 该如何写呢? 亲爱的大佬们<font color="deepskyblue">#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#Include <GuiListView.au3>
$SQLite_Data_Path = "MySQLite.db"
$Table = "textTable"
_SQLite_Startup ()
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 542, 267, 339, 297)
$ListView1 = GUICtrlCreateListView("id|text1|", 8, 8, 522, 246)
_GUICtrlListView_SetColumn($ListView1, 1, "text1", 300, -1)
tuqushuju()
GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY')
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
#EndRegion ### END Koda GUI section ###
Func tuqushuju()
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
Local $aRow, $hQuery,$i = 0
_SQLite_Open ($SQLite_Data_Path)
If _SQLite_Query(-1, "SELECT * FROM " & $Table & ";", $hQuery) = $SQLITE_OK Then
While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
_GUICtrlListView_AddItem($ListView1, $aRow[0], 0)
_GUICtrlListView_AddSubItem($ListView1, $i, BinaryToString($aRow[1]), 1)
$i+=1
WEnd
_SQLite_Close()
EndIf
EndFunc
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $tNMHDR, $hWndFrom, $iCode
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = DllStructGetData($tNMHDR, 'hWndFrom')
$iCode = DllStructGetData($tNMHDR, 'Code')
Switch $iCode
Case $NM_CLICK
$aItemIndex = _GUICtrlListView_GetSelectedIndices($ListView1, True)
If $aItemIndex[0] Then
$iCurIndex = $aItemIndex[1]
$text = _GUICtrlListView_GetItemText($ListView1, $iCurIndex, 1)
MsgBox(0,0,$text)
EndIf
EndSwitch
EndFunc ;==>WM_NOTIFY</font>
|