首页
社区
课程
招聘
[求助]LB_GETITEMDATA取不到对应值
发表于: 2014-4-3 08:43 3249

[求助]LB_GETITEMDATA取不到对应值

2014-4-3 08:43
3249
include windows.inc
include kernel32.inc
include user32.inc
include Comctl32.inc
include shell32.inc

includelib kernel32.lib
includelib user32.lib
includelib Comctl32.lib
includelib shell32.lib

DlgProc                        PROTO        :HWND,:UINT,:WPARAM,:LPARAM

.data
szItem1                db        "顶目一",0
szItem2                db        "项目二",0
message                db        "您选择了:%08d",0
.const

IDD_DIALOG1                        equ 101
IDC_LST1                        equ 1001
IDC_BTN1                        equ 1002
;#########################################################################

.data?
hlist                                dd ?
hInstance                        dd ?
.386
.model flat, stdcall  ;32 bit memory model
option casemap :none  ;case sensitive

include 示列.inc

.code

start:

        invoke GetModuleHandle,NULL
        mov                hInstance,eax

    invoke InitCommonControls
        invoke DialogBoxParam,hInstance,IDD_DIALOG1,NULL,addr DlgProc,NULL
        invoke ExitProcess,0

;########################################################################

DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
        LOCAL @buffer[128]:byte
        mov                eax,uMsg
        .if eax==WM_INITDIALOG
                invoke GetDlgItem,hWin,IDC_LST1
                mov hlist,eax
                invoke SendMessage,hlist,LB_ADDSTRING,0,offset szItem1
                invoke SendMessage,hlist,LB_ADDSTRING,0,offset szItem2
        .elseif eax==WM_COMMAND
                mov eax,wParam
                        .if ax==IDC_BTN1
                                invoke SendMessage,hlist,LB_GETCURSEL,0,0
                                invoke SendMessage,hlist,LB_GETITEMDATA,eax,0
                                ;这里永远返回0

                                invoke wsprintf,addr @buffer,offset message,eax
                                invoke MessageBox,hWin,addr @buffer,0,MB_OK
                        .endif
        .elseif eax==WM_CLOSE
                invoke EndDialog,hWin,0
        .else
                mov                eax,FALSE
                ret
        .endif
        mov                eax,TRUE
        ret

DlgProc endp

end start

invoke SendMessage,hlist,LB_GETITEMDATA,eax,0
                                ;这里永远返回0 取不到对应的值,请大牛指点下,这是我编写的测试程序,列表框取引索值对应的32位仁值

[课程]Android-CTF解题方法汇总!

收藏
免费 0
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//