.386 .model flat,stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc include \masm32\include\comctl32.inc includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib includelib \masm32\lib\comctl32.lib WinMain proto :DWORD,:DWORD,:DWORD,:DWORD EditWndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD InsertColumn MACRO handle,txt,width LOCAL lbl LOCAL strng jmp lbl strng db txt,0 lbl: mov col.imask,LVCF_TEXT or LVCF_WIDTH mov col.fmt,0 mov col.lx,width mov col.pszText,offset strng invoke lstrlen,offset strng mov col.cchTextMax,eax invoke SendMessage,handle,LVM_INSERTCOLUMN,0,addr col ENDM InsertItem MACRO handle,txt LOCAL lbl LOCAL strng jmp lbl strng db txt,0 lbl: mov item.imask,LVIF_TEXT mov item.iItem,0 mov item.iSubItem,0 mov item.pszText,offset strng invoke lstrlen,offset strng mov item.cchTextMax,eax invoke SendMessage,handle,LVM_INSERTITEM,0,addr item ENDM SetItemText MACRO handle,txt,itemnumber,subitemnumber LOCAL lbl LOCAL strng jmp lbl strng db txt,0 lbl: mov item.imask,LVIF_TEXT mov item.iItem,itemnumber mov item.iSubItem,subitemnumber mov item.pszText,offset strng invoke lstrlen,offset strng mov item.cchTextMax,eax invoke SendMessage,handle,LVM_SETITEMTEXT,0,addr item ENDM RGB macro red,green,blue xor eax,eax mov ah,blue shl eax,8 mov ah,green mov al,red endm .data ClassName db "SimpleWinClass",0 AppName db "Our First Window",0 hListView dd 0 szListViewClass db "SysListView32",0 .data? hInstance HINSTANCE ? CommandLine LPSTR ? buffer db 512 dup(?) col LVCOLUMN item LVITEM OldWndProc dd ? ItemEdited dd ? .code start: invoke GetModuleHandle, NULL mov hInstance,eax invoke InitCommonControls invoke GetCommandLine mov CommandLine,eax invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT invoke ExitProcess,eax WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD LOCAL wc:WNDCLASSEX LOCAL msg:MSG LOCAL hwnd:HWND mov wc.cbSize,SIZEOF WNDCLASSEX mov wc.style, CS_HREDRAW or CS_VREDRAW mov wc.lpfnWndProc, OFFSET WndProc mov wc.cbClsExtra,NULL mov wc.cbWndExtra,NULL push hInstance pop wc.hInstance mov wc.hbrBackground,COLOR_WINDOW+1 mov wc.lpszMenuName,NULL mov wc.lpszClassName,OFFSET ClassName invoke LoadIcon,NULL,IDI_APPLICATION mov wc.hIcon,eax mov wc.hIconSm,eax invoke LoadCursor,NULL,IDC_ARROW mov wc.hCursor,eax invoke RegisterClassEx, addr wc INVOKE CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,\ WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,\ CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,\ hInst,NULL mov hwnd,eax invoke ShowWindow, hwnd,SW_SHOWNORMAL invoke UpdateWindow, hwnd .WHILE TRUE invoke GetMessage, ADDR msg,NULL,0,0 .BREAK .IF (!eax) invoke TranslateMessage, ADDR msg invoke DispatchMessage, ADDR msg .ENDW mov eax,msg.wParam ret WinMain endp WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM LOCAL hEditBox:HWND .IF uMsg==WM_DESTROY invoke PostQuitMessage,NULL .ELSEIF uMsg==WM_CREATE invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR szListViewClass,0, WS_VSCROLL or WS_VISIBLE or \ WS_BORDER or WS_CHILD or \ LVS_REPORT or LVS_EDITLABELS,\ 0,0,470,200,hWnd,1000,hInstance,NULL mov hListView,eax invoke SendMessage,hListView,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_GRIDLINES InsertColumn hListView,"Width",120 InsertColumn hListView,"Length",120 InsertColumn hListView,"Amount",120 InsertColumn hListView,"Item",70 InsertColumn hListView,"#",20 InsertItem hListView,"1" SetItemText hListView,"Wo
Posted on 2001-05-08 19:14:00 by a nada