No se hacen tareas, gracias.
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menúinvoke SendMessage,hlsv,LVM_GETNEXTITEM,-1,LVNI_FOCUSED
HiloInicio
.....
...
..
TerminateThread(manejadorDeEsteHilo)
HiloFin
invoke CreatePopupMenu
mov hPopupMenu,eax
invoke AppendMenu,hPopupMenu,MF_STRING,IDM_HOLA2,addr Heading1
invoke AppendMenu,hPopupMenu,MF_STRING,IDM_HOLA,addr Heading2
invoke SetMenuDefaultItem,hPopupMenu,-1,TRUE
invoke GetCursorPos,addr pt
invoke SetForegroundWindow,hWnd
invoke TrackPopupMenu,hPopupMenu,TPM_LEFTALIGN,pt.x,pt.y,0,hWnd,NULL
invoke SetForegroundWindow,hWnd
invoke DestroyMenu,hPopupMenu
TITLE listview
.386
option casemap:none
.model flat,stdcall
include c:\masm32\include\windows.inc
include c:\masm32\include\kernel32.inc
include c:\masm32\include\user32.inc
include c:\masm32\include\comctl32.inc
includelib c:\masm32\lib\kernel32.lib
includelib c:\masm32\lib\user32.lib
includelib c:\masm32\lib\comctl32.lib
DlgProc PROTO,
hWnd:HWND,
uMsg:UINT,
wParam:WPARAM,
lParam:LPARAM
.const
IDC_LSV1 equ 1001
IDC_BTN1 equ 1002
M1 equ 1003
IDR_MENU1 equ 10000
IDM_Hola2 equ 10002
IDM_HOLA equ 10001
.data
DlgName byte "Hola",0
Heading1 byte "Test1",0
Heading2 byte "Test2",0
.data?
hInstance HINSTANCE ?
CommandLine LPSTR ?
hlsv HANDLE ?
fila DWORD 0
hMenu HMENU ?
hPopupMenu HMENU ?
pt POINT <>
.code
ShowOption proc,
hWnd:HWND
invoke SendMessage,hlsv,LVM_GETNEXTITEM,-1,LVNI_FOCUSED
invoke LoadMenu,NULL,IDR_MENU1
mov hMenu,eax
invoke GetSubMenu,hMenu,0
mov hPopupMenu,eax
invoke SetMenuDefaultItem,hPopupMenu,-1,TRUE
invoke GetCursorPos,addr pt
invoke SetForegroundWindow,hWnd
invoke TrackPopupMenu,hPopupMenu,TPM_LEFTALIGN,pt.x,pt.y,0,hWnd,NULL
invoke SetForegroundWindow,hWnd
invoke DestroyMenu,hPopupMenu
invoke DestroyMenu,hMenu
;invoke SendMessage,hlsv,LVM_DELETEITEM,eax,0
ret
ShowOption endp
InsertColumn proc,
hWnd:HWND
LOCAL lvc:LV_COLUMN
mov lvc.imask,LVCF_TEXT+LVCF_WIDTH
mov lvc.pszText,offset Heading1
mov lvc.lx,150
invoke SendMessage,hWnd, LVM_INSERTCOLUMN,0,addr lvc
or lvc.imask,LVCF_FMT
mov lvc.fmt,LVCFMT_RIGHT
mov lvc.pszText,offset Heading2
mov lvc.lx,100
invoke SendMessage,hWnd, LVM_INSERTCOLUMN, 1 ,addr lvc
ret
InsertColumn endp
InsertItem proc
LOCAL lvi:LV_ITEM
mov lvi.imask,LVIF_TEXT+LVIF_PARAM
push fila
pop lvi.iItem
mov lvi.iSubItem,0
mov lvi.pszText,offset Heading1
push fila
pop lvi.lParam
invoke SendMessage,hlsv, LVM_INSERTITEM,0, addr lvi
mov lvi.imask,LVIF_TEXT
inc lvi.iSubItem
mov lvi.pszText,offset Heading2
invoke SendMessage,hlsv,LVM_SETITEM, 0,addr lvi
inc Heading2
push eax
push eax
ret
InsertItem endp
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke GetCommandLine
mov CommandLine,eax
invoke DialogBoxParam,hInstance,ADDR DlgName,NULL,ADDR DlgProc,NULL
invoke ExitProcess,eax
DlgProc PROC hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.IF uMsg == WM_INITDIALOG
invoke InitCommonControls
invoke GetDlgItem,hWnd,IDC_LSV1
mov hlsv,eax
invoke InsertColumn,eax
; invoke GetDlgItem,hWnd,IDC_FOCUS
; invoke SetFocus,eax
.ELSEIF uMsg == WM_COMMAND
mov eax,wParam
mov edx,wParam
shr edx,16
.if dx==BN_CLICKED
.if ax==IDC_BTN1
invoke InsertItem
.endif
.endif
.ELSEIF uMsg == WM_CLOSE
invoke EndDialog,hWnd,NULL
.ELSEIF uMsg==WM_NOTIFY
push edi
mov edi,lParam
assume edi:ptr NMHDR
mov eax,[edi].hwndFrom
.if eax==hlsv
.if [edi].code==NM_DBLCLK
invoke ShowOption,hWnd
.endif
.endif
.ELSE
mov eax,FALSE
ret
.ENDIF
mov eax,TRUE
ret
DlgProc ENDP
END start
IDR_MENU1 MENU
BEGIN
MENUITEM "Hola1",IDM_HOLA1
MENUITEM "Hola2",IDM_HOLA2
END