Jump to content

if object selected in listbox


Recommended Posts

The helpfile explains what functions do.

_GUICtrlListBox_GetSel($hWnd,$iIndex)

$hWnd = the Handle of the listbox, $iIndex is the index of a row in the listbox.

If sro_client.exe is always on the same row then use that static index (zero-based), otherwise you can loop through the rows of the list box. Use_GUICtrlListBox_GetCount($hWnd)

Edited by spudw2k
Link to comment
Share on other sites

uuhm this is my code at the end it says $ProcID i want that id first in the listbox

and if that id selected then button enabled

$GUI = GUICreate("", 200, 200)
$Form1 = GUICreate("No Dc Patcher", 272, 215, 193, 125)
$List1 = GUICtrlCreateList( "", 16, 24, 161, 136)
$Button1 = GUICtrlCreateButton("Refresh", 184, 24, 73, 137, 0)
$Button2 = GUICtrlCreateButton("Patch", 16, 168, 161, 33, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
$Group1 = GUICtrlCreateGroup(" No Dc  ", 8, 8, 257, 201)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    If $msg = $Button2 Then
    PatchSro()
    EndIf

    If $msg = $Button1 Then
    Refresh()
    EndIf 

    If $msg = $GUI_EVENT_CLOSE Then
    Exit
    
EndIf

Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button2
            $PL = ProcessList()
            GUICtrlSetData($list1, "lol")
            WinSetTitle($GUI, "", "Processes " & $PL[0][0])
            For $i = 1 To $PL[0][0]
                GUICtrlSetData($list1, $PL[$i][1] & "  " & $PL[$i][0])
            Next   
    EndSelect
        
WEnd

Func Refresh()
    GUICtrlSetState($button2,$GUI_ENABLE)
EndFunc
Func PatchSro()
If ProcessExists("sro_client.exe") Then
    $ProcID = ProcessExists("sro_client.exe")
    $OpenProc = _MemoryOpen($ProcID) 
    ;JMP 00bc9e20
    _MemoryWrite(0x0073f52e, $OpenProc, 0xe9, "byte[1]")
    _MemoryWrite(0x0073f52f, $OpenProc, 0xe0, "byte[1]")
    _MemoryWrite(0x0073f530, $OpenProc, 0xa8, "byte[1]")
    _MemoryWrite(0x0073f531, $OpenProc,  0x48, "byte[1]")
    _MemoryWrite(0x0073f533, $OpenProc, 0x90, "byte[1]") ;NOP
    
    ;MOV EAX, 492E20
    _MemoryWrite(0x00bc9e13, $OpenProc, 0xb8, "byte[1]")
    _MemoryWrite(0x00bc9e14, $OpenProc, 0x20, "byte[1]")
    _MemoryWrite(0x00bc9e15, $OpenProc, 0x2e, "byte[1]")
    _MemoryWrite(0x00bc9e16, $OpenProc, 0x49, "byte[1]")
    
    ;CALL EAX
    _MemoryWrite(0x00bc9e18, $OpenProc, 0xff, "byte[1]")
    _MemoryWrite(0x00bc9e19, $OpenProc, 0xd0, "byte[1]")
    
    ;POP EDI
    _MemoryWrite(0x00bc9e1a, $OpenProc, 0x5f, "byte[1]")
    
    ;ADD ESP, 10
    _MemoryWrite(0x00bc9e1b, $OpenProc, 0x83, "byte[1]")
    _MemoryWrite(0x00bc9e1c, $OpenProc, 0xc4, "byte[1]")
    _MemoryWrite(0x00bc9e1d, $OpenProc, 0x10, "byte[1]")
    
    ;RETN
    _MemoryWrite(0x00bc9e1e, $OpenProc, 0xc3, "byte[1]")
    
    MsgBox(0, "Patch Successful", "No disconnect has been applied to process " & $ProcID)
Else
    MsgBox(0, "Message", "No process or wrong process selected")
EndIf
EndFunc
Link to comment
Share on other sites

if sro_client.exe selected in a listbox

then must a button be enabled else disabled

So, something like this?

#include <guiconstants.au3>
$form = GUICreate("Test", 600, 600)
$list = GUICtrlCreateList("", 0, 0, 599, 570, BitOR($LBS_NOTIFY, $WS_VSCROLL, $LBS_SORT, $WS_BORDER))
$refresh = GUICtrlCreateButton("Refresh", 0, 570, 90, 25)

$Patch = GUICtrlCreateButton("Patch", 150, 570, 90, 25)
GUICtrlSetState(-1, $GUI_HIDE)

GUISetState()

Refresh()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $refresh
            Call("Refresh")
        Case $list
            $item = GUICtrlRead($list, 1)
            If $item <> "sro_client.exe" Then
            Else
                GUICtrlSetState($Patch, $GUI_SHOW)
            EndIf
        Case $Patch
            Call("Patch")
    EndSwitch
WEnd


Func Refresh()
    $list2 = ProcessList()
    For $i = 1 To $list2[0][0]
        GUICtrlSetData($list, $list2[$i][0], "sro_client.exe")
        
    Next
EndFunc

Func Patch()
    ConsoleWrite("At patch" & @CRLF)
EndFunc

Builds a GUI window, builds a list, populates the list with processes, allows the user to select a process, which automatically checks if the selected process is the 'sro_client.exe' file. If not, does nothing, if so, enables a patch button; if clicked calls a patch function. Refresh, refreshes the list.

NOTE: I didn't really read the rest of the post, just the first part; so if already accomplished, just disregard my code there.

Edited by zackrspv

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

So, something like this?

#include <guiconstants.au3>
$form = GUICreate("Test", 600, 600)
$list = GUICtrlCreateList("", 0, 0, 599, 570, BitOR($LBS_NOTIFY, $WS_VSCROLL, $LBS_SORT, $WS_BORDER))
$refresh = GUICtrlCreateButton("Refresh", 0, 570, 90, 25)

$Patch = GUICtrlCreateButton("Patch", 150, 570, 90, 25)
GUICtrlSetState(-1, $GUI_HIDE)

GUISetState()

Refresh()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $refresh
            Call("Refresh")
        Case $list
            $item = GUICtrlRead($list, 1)
            If $item <> "sro_client.exe" Then
            Else
                GUICtrlSetState($Patch, $GUI_SHOW)
            EndIf
        Case $Patch
            Call("Patch")
    EndSwitch
WEnd


Func Refresh()
    $list2 = ProcessList()
    For $i = 1 To $list2[0][0]
        GUICtrlSetData($list, $list2[$i][0], "sro_client.exe")
        
    Next
EndFunc

Func Patch()
    ConsoleWrite("At patch" & @CRLF)
EndFunc

Builds a GUI window, builds a list, populates the list with processes, allows the user to select a process, which automatically checks if the selected process is the 'sro_client.exe' file. If not, does nothing, if so, enables a patch button; if clicked calls a patch function. Refresh, refreshes the list.

NOTE: I didn't really read the rest of the post, just the first part; so if already accomplished, just disregard my code there.

thx and no i was not ready :D

thx thx thx xD

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