Sign in to follow this  
Followers 0
Rawox

Listview delete INI information...

5 posts in this topic

#1 ·  Posted (edited)

Hee Guys,

Wanted to remove a whole row ,by pressing delete on the keyboard, from a listview in my GUI.

I tried _GUICtrlListView_DeleteItem() and _GUICtrlListView_DeleteItemsSelected() but I couldn't figure it out with both ;)

Can anyone help me with this?

Thanks in advance, Rawox

||EDIT: NEW PROBLEM||

I've got it deleted from the listview, but every time a user adds a value it's also stored in a INI. I do now need to delete this from the INI also...

Sentences=2
Sentence1=asdfasdjf
Mood1=None
Sentence2=sdfasdf
Mood2=Wow!

Any ideas??

Edited by Rawox

Share this post


Link to post
Share on other sites



Firstly, you need to detect the key press. WM_NOTIFY does the job with "LVN_KEYDOWN". I ran a quick test and got this result from pressing the delete key.

VKey: 22216750
Flags: 5242880

And the LoWord of VKey is equal to:

VK_DELETE (0x2E (46))

You can then Delete the selected items. (_Delete)

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR, $tInfo

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    If (HWnd(DllStructGetData($tNMHDR, "hWndFrom")) = $hWndListView) And (DllStructGetData($tNMHDR, "Code") = $LVN_KEYDOWN) Then
        $tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
        If BitAND (DllStructGetData ($tInfo, "VKey"), 0xFFFF) = 46 Then _Delete ()
    EndIf
EndFunc   ;==>WM_NOTIFY

Sorry if its not the best example ever, but it should give a rough example...

Mat

Share this post


Link to post
Share on other sites

Well I simply did this by using isPressed but I think this is a better alternative!

But my problem was how I actually needed to delete the item that is highlighted/selected...?

Share this post


Link to post
Share on other sites

Here is:

#include <GUIConstants.au3>
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>


#Region ### START Koda GUI section ### Form=Form1.kxf\Form1.kxf
$Form1_1 = GUICreate("Form1", 998, 551, 203, 109)
$goster ="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run: "
$List1 = GUICtrlCreateListView("KEY" &"|" & "Name" & "|" & "Entry", 16, 24, 969, 409) ;

;GUICtrlSetData($List1,$goster)
$Button1 = GUICtrlCreateButton("SCAN STARTUP", 72, 464, 105, 33, 0)
$Button2 = GUICtrlCreateButton("DELETE SEL..ENTRY ", 824, 464, 113, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$i ="|"
$a = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $i)
; ikinci key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run-

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
        _GUICtrlListView_DeleteAllItems($List1)
    for $i =1 to 20
                $a = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $i)
                $b = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $a)

                if $a = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $i) Then
                    $c = StringReplace($a, "Дополнительные данные отсутствуют.", "")
                    $d = StringReplace($c, @CRLF, "")



                    $once =RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run-", $i)
                $alternativ="|HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run- :"
                $onceparam =RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run-", $once)
                if $d ="" Then
                    GUICtrlCreateListViewItem("|" &  $d & "|" & $b, $List1)
                    Else

    GUICtrlCreateListViewItem($goster & "|" &  $d & "|" & $b, $List1)



    EndIf

EndIf




                                      ;






Next
Case $Button2

_GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($List1))

     $delete = _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($List1))








    $myparamgetcolumn = _GUICtrlListView_GetSelectedColumn($List1)
    ;MsgBox(64, "Get Columnselected",$myparamgetcolumn)




    EndSwitch
WEnd

[size="5"] [/size]

Share this post


Link to post
Share on other sites

Thanks!

This line helped:

_GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($List1))

Share this post


Link to post
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
Sign in to follow this  
Followers 0