Tengo el siguiente código:
Código
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 .data DlgName byte "Hola",0 Heading1 byte "Test1",0 Heading2 byte "Test2",0 .data? hInstance HINSTANCE ? CommandLine LPSTR ? .code 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 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 InsertColumn,hWnd ; invoke GetDlgItem,hWnd,IDC_FOCUS ; invoke SetFocus,eax .ELSEIF uMsg == WM_CLOSE invoke EndDialog,hWnd,NULL .ELSE mov eax,FALSE ret .ENDIF mov eax,TRUE ret DlgProc ENDP END start
El problema que tengo es que la siguiente línea no funciona correctamente:
Código
invoke SendMessage,hWnd, LVM_INSERTCOLUMN,0,addr lvc
¿alguien podría guiarme para insertar las columnas?, saludos y gracias de ante mano
Solución: obtener con GetDlgItem el manejador:
Código
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 .data DlgName byte "Hola",0 Heading1 byte "Test1",0 Heading2 byte "Test2",0 .data? hInstance HINSTANCE ? CommandLine LPSTR ? .code 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 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 invoke InsertColumn,eax ; invoke GetDlgItem,hWnd,IDC_FOCUS ; invoke SetFocus,eax .ELSEIF uMsg == WM_CLOSE invoke EndDialog,hWnd,NULL .ELSE mov eax,FALSE ret .ENDIF mov eax,TRUE ret DlgProc ENDP END start