Código
.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 includelib c:\masm32\lib\kernel32.lib includelib c:\masm32\lib\user32.lib DlgProc PROTO, hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM .const .data DlgName byte "IDD_DLG1",0 processName byte "calc.exe",0 .data? hInstance HINSTANCE ? CommandLine LPSTR ? hThread HANDLE ? processInf PROCESSENTRY32 <> .code FindProcess PROC LOCAL hSnapshot:HANDLE invoke CreateToolhelp32Snapshot,TH32CS_SNAPPROCESS,0 mov hSnapshot,eax invoke Process32First,hSnapshot,addr processInf invoke Process32Next,hSnapshot,addr processInf invoke GetLastError ret FindProcess 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 mov processInf.dwSize,sizeof PROCESSENTRY32 invoke CreateThread,NULL,0,ADDR FindProcess,NULL,0,0 mov hThread,eax push eax .ELSEIF uMsg == WM_CLOSE invoke EndDialog,hWnd,NULL .ELSE mov eax,FALSE ret .ENDIF mov eax,TRUE ret DlgProc ENDP END start