here is the code
.386 .model flat, stdcall option casemap:none include windows.inc include user32.inc includelib user32.lib include kernel32.inc includelib kernel32.lib include comctl32.inc includelib comctl32.lib include masm32.inc includelib masm32.lib DlgProc Proto :DWORD, :DWORD, :DWORD, :DWORD .Const IDC_PROGRESS equ 1017 IDC_STATUS equ 2 IDC_TIMER equ 3 .data Message db "Finished!",0 TimerID dd 0 Percent db ' % done.',0 .data? hInstance HINSTANCE ? hwndProgress dd ? hwndStatus dd ? CurrentStep dd ? Done dd ? .Code Start: invoke GetModuleHandle, NULL mov hInstance, eax invoke GetCommandLine invoke DialogBoxParam, hInstance, 1001, NULL, Addr DlgProc, NULL invoke ExitProcess,0 DlgProc Proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM LOCAL buffer[256]:BYTE .if uMsg == WM_INITDIALOG mov eax, wParam invoke GetDlgItem,hWnd,1002 ; progressbar setup mov hwndProgress,eax mov CurrentStep,1000 shl eax,16 ;/* Shift Logical Left , Usage:SHL dest,count */ invoke SendMessage,hwndProgress,PBM_SETRANGE,0,eax invoke SendMessage,hwndProgress,PBM_SETSTEP,10,0 xor Done,0 ; Percent static setup invoke SetTimer,hWnd,IDC_TIMER,100,NULL ; setup timer mov TimerID,eax .elseif uMsg == WM_TIMER invoke SendMessage,hwndProgress,PBM_STEPIT,0,0 sub CurrentStep,10 add Done,1 ; Static update invoke dwtoa,Done,addr buffer invoke lstrcat,addr buffer, offset Percent invoke SendDlgItemMessage,hWnd,1004,WM_SETTEXT,0,addr buffer .if CurrentStep == 0 invoke KillTimer,hWnd,TimerID mov TimerID,0 invoke SendMessage,hwndStatus,SB_SETTEXT,0,offset Message invoke MessageBox,hWnd,offset Message,offset Message,MB_OK+MB_ICONINFORMATION invoke SendMessage,hwndStatus,SB_SETTEXT,0,0 invoke SendMessage,hwndProgress,PBM_SETPOS,0,0 .endif .elseif uMsg == WM_CLOSE .if TimerID!=0 invoke KillTimer,hWnd,TimerID .endif invoke DestroyWindow,hWnd ret .endif xor eax,eax ret DlgProc endp End Start

New Topic/Question
Reply



MultiQuote






|