The MASM Forum

General => The Campus => Topic started by: xandaz on January 26, 2021, 08:58:11 PM

Title: Newly made process terminator
Post by: xandaz on January 26, 2021, 08:58:11 PM
    Hey guys. Made this little app to terminate process alike the TaskManager. There ae still some issues regarding the position of the menu but works fine. Thanks guys. You're the best
Title: Re: Newly made process terminator
Post by: xandaz on January 26, 2021, 09:38:04 PM
    Menu coodinates fixed. Working well. Thanks guys
Title: Re: Newly made process terminator
Post by: xandaz on January 26, 2021, 10:01:27 PM
   I was thinking how you get the icons for each process but haven't found out how to do it. Doesn anyone know how? Thanks in advance
Title: Re: Newly made process terminator
Post by: jj2007 on January 26, 2021, 10:56:56 PM
Compliments, that looks very nice :thumbsup:
Title: Re: Newly made process terminator
Post by: xandaz on January 26, 2021, 10:58:12 PM
   it's not working so well. i'll get it fixed right away
Title: Re: Newly made process terminator
Post by: xandaz on January 26, 2021, 11:45:08 PM
  The terminateProcess function is crashing the app. Why the hell is that? Can u take a look JJ. Thanks
Title: Re: Newly made process terminator
Post by: jj2007 on January 27, 2021, 12:18:50 AM
Quote from: xandaz on January 26, 2021, 11:45:08 PMCan u take a look JJ

For reasons that I don't understand I can build your source but the exe does not list any processes - and getting that list is not a big deal, see below. Mysteries of Windows :sad:

include \masm32\MasmBasic\Res\MbGui.asm
  GetProcessArray()
  GuiControl MyList, "listbox", MbProc$()
  GuiControl Status, "statusbar", wStr$("%i processes found", MbProc$(?))
GuiEnd
Title: Re: Newly made process terminator
Post by: xandaz on January 27, 2021, 01:20:18 AM
   Very good JJ. Are you aware of any incompatibility between LVIF_TEXT and LVIF_PARAM in the LV_ITEM struct? When i mention LVIF_PARAM no text is shown. Thanks
Title: Re: Newly made process terminator
Post by: jj2007 on January 27, 2021, 02:00:17 AM
I've never used LVIF_PARAM, but I know that LVIF_TEXT works fine
Title: Re: Newly made process terminator
Post by: xandaz on January 27, 2021, 02:18:12 AM
    whar's the reverse macro of  ustr$?
Title: Re: Newly made process terminator
Post by: xandaz on January 27, 2021, 02:51:57 AM
   For further notice LVIF_TEXT+LVIF_PARAM only works for items. Doesnt work for subitems. I leave her the process enumerater/terminator for y'all. Thanks
Title: Re: Newly made process terminator
Post by: xandaz on January 27, 2021, 05:24:48 AM
   Hi guys. I've been having a hard time with LVM_SETIMAGELIST. I used SHGetFileInfo to get the icons index but when i call LVM_SETIMAGELIST it returns NULL. here's a portion of the code: mov hToolhelp,rv(CreateToolhelp32Snapshot,TH32CS_SNAPALL,0)
mov pe32.dwSize,sizeof PROCESSENTRY32
mov me32.dwSize,sizeof MODULEENTRY32
invoke Process32First,hToolhelp,addr pe32
invoke Module32First,hToolhelp,addr me32
invoke SHGetFileInfo,addr me32.szExePath,0,addr shfi,sizeof shfi,SHGFI_SMALLICON+SHGFI_SYSICONINDEX
push eax
invoke MessageBox,0,ustr$(eax),0,MB_OK
pop eax
invoke SendMessage,hLV,LVM_SETIMAGELIST,eax,LVSIL_SMALL
invoke MessageBox,0,ustr$(eax),0,MB_OK
m2m lvi.iImage,shfi.iIcon
Title: Re: Newly made process terminator
Post by: xandaz on January 27, 2021, 06:09:23 AM
   I've been trying to get the icons either via SHGetFileInfo or ExtractAssociatedIcon but none of the two satisfy me. This is how it stands.
Title: Re: Newly made process terminator
Post by: Greenhorn on January 27, 2021, 08:53:16 AM
Does SHGetFileInfo (https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shgetfileinfow) return a handle to an image list ?

Are the parameters of SendMessage (hLV, LVM_SETIMAGELIST (https://docs.microsoft.com/en-us/windows/win32/controls/lvm-setimagelist), ...) not twisted ?
Title: Re: Newly made process terminator
Post by: xandaz on January 28, 2021, 01:13:11 AM
   Yes it does, but it offers even worse results than using ExtractAssociatedIcon. There's got to be another way to do this. Thanks
Title: Re: Newly made process terminator
Post by: xandaz on January 28, 2021, 05:51:25 AM
   Finally got it to work. Thanks you all.
Title: Re: Newly made process terminator
Post by: sergei_lost_mail on January 29, 2021, 02:24:12 AM
Your example works, but the icons show the icons of the directory it's in. When I recompile the list seems empty. (Winclasses.asm I got this file from your previous posts.) Thank you, nice sharing.
Title: Re: Newly made process terminator
Post by: xandaz on February 01, 2021, 10:18:51 PM
  no....thanks you.
Title: Re: Newly made process terminator
Post by: xandaz on February 02, 2021, 12:04:48 AM
   I've been dwelling between SHGetFileInfo and ExtractAssociatedIcon/ExtractIcon functions. Either of the methods work badly. I'm not so confidant i can deliver a fully working example. Thanks guys
Title: Re: Newly made process terminator
Post by: xandaz on February 02, 2021, 12:23:01 AM
   Best working example so far.
Title: Re: Newly made process terminator
Post by: xandaz on February 02, 2021, 01:37:04 AM
   At last working. Still not very satisfyingly but works. Some icons seem to be mismatched. Thanks