找回密码
 加入
搜索
查看: 2063|回复: 4

[AU3基础] GUICtrlCreateListView 内容无法删除,请前辈帮忙看一下![已解决]

[复制链接]
发表于 2012-2-28 15:06:20 | 显示全部楼层 |阅读模式
本帖最后由 f4李文杨 于 2012-2-28 16:06 编辑

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <GuiTreeView.au3>
$Form1_1 = GUICreate("Form1", 852, 557, 271, 126)
$MenuItem1 = GUICtrlCreateMenu("帮助支持(&Z)")
$MenuItem2 = GUICtrlCreateMenuItem("技术支持", $MenuItem1)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
Dim $StatusBar1_PartsWidth[1] = [-1]
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, "软件", 0)
$Group1 = GUICtrlCreateGroup("", 152, 84, 698, 430)
$Group2 = GUICtrlCreateGroup("影片类型操作", 160, 97, 281, 137)
$Label1 = GUICtrlCreateLabel("影片类型:", 267, 124, 64, 17)
$Input1 = GUICtrlCreateInput("Input1", 331, 121, 97, 21)
GUICtrlSetTip(-1, "操作[电影类型]相应的设置或修改...")
$Button1 = GUICtrlCreateButton("添 加", 269, 148, 51, 25)
$Button2 = GUICtrlCreateButton("删 除", 325, 148, 51, 25)
$Button3 = GUICtrlCreateButton("修 改", 382, 148, 51, 25)
$Label2 = GUICtrlCreateLabel("请选者影片存放盘符:", 266, 181, 124, 17)
$Combo1 = GUICtrlCreateCombo("C:", 390, 179, 45, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Button4 = GUICtrlCreateButton("保 存", 269, 200, 51, 25)
$Label3 = GUICtrlCreateLabel("只对本地游戏有效", 330, 207, 100, 17)
GUICtrlSetColor(-1, 0xFF0000)
$ListView1 = GUICtrlCreateListView("影片类型", 168, 128, 89, 97)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("客户端设置", 160, 240, 281, 265)
$Label4 = GUICtrlCreateLabel("客户端标题:", 176, 264, 76, 17)
$Input2 = GUICtrlCreateInput("Input2", 256, 256, 169, 21)
$Label5 = GUICtrlCreateLabel("视频主标题:", 176, 288, 76, 17)
$Input3 = GUICtrlCreateInput("Input3", 256, 288, 169, 21)
$Label6 = GUICtrlCreateLabel("客户端皮肤:", 176, 320, 76, 17)
$Combo2 = GUICtrlCreateCombo("Combo2", 256, 320, 169, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Label7 = GUICtrlCreateLabel("客户端播放模式:", 176, 352, 100, 17)
$Combo3 = GUICtrlCreateCombo("Combo3", 280, 352, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Label8 = GUICtrlCreateLabel("客户端播放调用:", 176, 384, 100, 17)
$Combo4 = GUICtrlCreateCombo("Combo4", 280, 384, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Label9 = GUICtrlCreateLabel("服务器更新地址:", 176, 416, 100, 17)
$Input4 = GUICtrlCreateInput("Input4", 280, 416, 145, 21)
$Button5 = GUICtrlCreateButton("保存设置", 344, 456, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("软件注册信息", 448, 97, 393, 408)
$Input5 = GUICtrlCreateInput("Input5", 456, 129, 369, 21)
$Input6 = GUICtrlCreateInput("Input6", 456, 161, 369, 21)
$Input7 = GUICtrlCreateInput("Input7", 456, 192, 369, 21)
$Input8 = GUICtrlCreateInput("Input8", 456, 224, 369, 21)
$Input9 = GUICtrlCreateInput("Input9", 456, 256, 369, 21)
$Label10 = GUICtrlCreateLabel("注册码:", 456, 296, 52, 17)
$Input10 = GUICtrlCreateInput("Input10", 512, 288, 313, 21)
$Label11 = GUICtrlCreateLabel("注册号:", 456, 328, 52, 17)
$Input11 = GUICtrlCreateInput("Input11", 512, 320, 313, 21)
$Button6 = GUICtrlCreateButton("注 册", 472, 360, 75, 25)
$Button7 = GUICtrlCreateButton("重新注册", 592, 360, 75, 25)
$Button8 = GUICtrlCreateButton("试用软件", 712, 360, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1                ;添加  这里添加可以!
                        _GUICtrlListView_AddItem($ListView1, GUICtrlRead($Input1), 0)

                Case $Button2                ;删除 以下两种都无法删除不知这么回事,请高手解决一下!
                       
                        _GUICtrlListView_DeleteItem($ListView1, _GUICtrlListView_GetSelectionMark($ListView1))

                        $D17 = _GUICtrlListView_GetItemText($ListView1, _GUICtrlListView_GetSelectionMark($ListView1), 0)
                        If $D17 <> "" Then
                                _GUICtrlListView_DeleteItemsSelected($ListView1)
                        Endif
        EndSwitch
WEnd


我都试了好几种了!获取ID也对! 就是删除不了!也清空不了!GUICtrlCreateListView  控件上的内容!不知道这么回事!请高手解决一下!非常感谢!
 楼主| 发表于 2012-2-28 15:43:20 | 显示全部楼层
晕说了一句就走了............
发表于 2012-2-28 15:49:30 | 显示全部楼层
$hListView1=guictrlgethandle($ListView1)
把后面的listview1换成句柄再试试

评分

参与人数 1金钱 +10 贡献 +5 收起 理由
f4李文杨 + 10 + 5 谢谢提醒!

查看全部评分

发表于 2012-2-28 15:55:11 | 显示全部楼层
3楼正解,  _GUICtrlListView_DeleteItem 第一个参数用的句柄 .
经测试, 删除成功!
 楼主| 发表于 2012-2-28 16:05:18 | 显示全部楼层
多谢元老了!!我一起没有想起句柄!!测式成功!谢谢!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-30 19:37 , Processed in 0.102628 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表