|
楼主 |
发表于 2014-8-27 14:15:16
|
显示全部楼层
贴上全部代码··希望好心人能帮忙修改····
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
include comctl32.inc
includelib comctl32.lib
includelib user32.lib
includelib kernel32.lib
.data?
hInstance dd ?
hWinMain dd ?
hList dd ?
.data
szClassName db 'ListViewWinClass',0
szAppName db '视图列表程序',0
LVMClassName db 'SysListView32',0
szLVCaption1 db '句柄',0
szLVCaption2 db '文件名称',0
szLVCaption3 db '文件名称aaaa',0
szTemplate db '%08x',0
.code
_ShowProcessInfo proc uses edi _dwRow,_lpProcess
LOCAL @stLVI:LV_ITEM
LOCAL @szBuffer[10]:byte
mov edi,_lpProcess
assume edi:ptr PROCESSENTRY32
mov @stLVI.imask,LVIF_TEXT or LVIF_PARAM
push _dwRow
pop @stLVI.iItem
mov @stLVI.iSubItem,0
push _dwRow
pop @stLVI.lParam
invoke wsprintf,addr @szBuffer,offset szTemplate,[edi].th32ProcessID
lea eax,@szBuffer
mov @stLVI.pszText,eax
invoke SendMessage,hList,LVM_INSERTITEM,0,addr @stLVI
inc @stLVI.iSubItem
mov @stLVI.pszText,eax
lea eax,[edi].szExeFile
mov @stLVI.pszText,eax
invoke SendMessage,hList,LVM_SETITEM,0,addr @stLVI
assume edi:nothing
ret
_ShowProcessInfo endp
_FillFileInfo proc uses edi
LOCAL @hSnapshot
LOCAL @stProcess:PROCESSENTRY32
invoke CreateToolhelp32Snapshot,TH32CS_SNAPPROCESS,0
mov @hSnapshot,eax
mov @stProcess.dwSize,sizeof @stProcess
invoke Process32First,@hSnapshot,addr @stProcess
xor edi,edi
.while eax
invoke _ShowProcessInfo,edx,addr @stProcess
inc edi
invoke Process32Next,@hSnapshot,addr @stProcess
.endw
invoke CloseHandle,@hSnapshot
ret
_FillFileInfo endp
_InsertColumn proc
LOCAL @stLVC:LV_COLUMN
mov @stLVC.imask,LVCF_TEXT OR LVCF_WIDTH
mov @stLVC.pszText,offset szLVCaption1
mov @stLVC.lx,100
invoke SendMessage,hList,LVM_INSERTCOLUMN,0,addr @stLVC
OR @stLVC.imask,LVCF_FMT
mov @stLVC.pszText,offset szLVCaption2
mov @stLVC.lx,200
mov @stLVC.fmt,LVCFMT_LEFT
invoke SendMessage,hList,LVM_INSERTCOLUMN,1,addr @stLVC
mov @stLVC.pszText,offset szLVCaption3
mov @stLVC.lx,200
mov @stLVC.fmt,LVCFMT_LEFT
invoke SendMessage,hList,LVM_INSERTCOLUMN,2,addr @stLVC
ret
_InsertColumn endp
_WndProc proc uses esi edi ebx,hWnd,uMsg,wParam,lParam
mov eax,uMsg
.if eax==WM_CLOSE
invoke DestroyWindow,hWnd
invoke PostQuitMessage,0
.elseif eax==WM_CREATE
invoke CreateWindowEx, NULL, addr LVMClassName, NULL, LVS_REPORT+WS_CHILD+WS_VISIBLE, \
0,0,800,700,hWnd, NULL, hInstance, NULL
mov hList, eax
invoke _InsertColumn
invoke _FillFileInfo
;
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
_WndProc endp
_WinMain proc
LOCAL @stWC:WNDCLASSEX
LOCAL @stMsg:MSG
invoke GetModuleHandle,0
mov hInstance,eax
invoke RtlZeroMemory,addr @stWC,sizeof @stWC
mov @stWC.cbSize,sizeof WNDCLASSEX
mov @stWC.style,0
mov @stWC.lpfnWndProc,offset _WndProc
mov @stWC.cbClsExtra,0
mov @stWC.cbWndExtra,0
push hInstance
pop @stWC.hInstance
mov @stWC.hIcon,0
invoke LoadCursor,hInstance,IDC_ARROW
mov @stWC.hCursor,eax
mov @stWC.hbrBackground,COLOR_WINDOW+1
mov @stWC.lpszMenuName,0
mov @stWC.lpszClassName,offset szClassName
mov @stWC.hIconSm,0
invoke RegisterClassEx,addr @stWC
invoke CreateWindowEx,NULL,addr szClassName,addr szAppName,WS_OVERLAPPEDWINDOW,\
400,400,800,800,0,0,hInstance,0
mov hWinMain,eax
invoke ShowWindow,hWinMain,SW_SHOWNORMAL
invoke UpdateWindow,hWinMain
.while TRUE
invoke GetMessage,addr @stMsg,0,0,0
.break .if eax==0
invoke TranslateMessage,addr @stMsg
invoke DispatchMessage,addr @stMsg
.endw
ret
_WinMain endp
start:
invoke InitCommonControls
invoke _WinMain
invoke ExitProcess,0
end start |
|