forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Running programs...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Mar 22, 2003 10:59 pm    Post subject: Running programs... Reply with quote

Here's a handy utility for listing all running programs in Windows,
including those that DO NOT show with CTRL+ALT+DEL. If no
window title is available, it still shows the class name and handle.

Saves the list to c:\winlist.txt (with the current time) then opens
it for ya. Wink
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac

LIST CREATE, 1
LIST CREATE, 2

LIST WINLIST, 1, NCI
LIST ADD, 2, @count(1) programs running @datetime(mm/dd/yyyy hh:nn:ss am/pm)
LIST ADD, 2, ""

%x = 0
REPEAT
  PARSE "%n;%c;%i", @item(1, %x)
  if @not(%n)
     %n = "unknown..."
  end
  if @not(%c)
     %c = "unknown..."
  end
  if @not(%i)
     %i = "unknown..."
  end
  LIST ADD, 2, "Window= "%n
  LIST ADD, 2, " Class= "%c
  LIST ADD, 2, "Handle= "%i
  LIST ADD, 2, ""
  %x = @succ(%x)
UNTIL @greater(%x, @pred(@count(1)))

LIST SAVEFILE, 2, c:\winlist.txt
WAIT
SHELL OPEN, c:\winlist.txt

:CLOSE
  EXIT

EDIT - Small change - now shows number of programs running.

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Mar 26, 2003 4:55 am    Post subject: Reply with quote

Slightly different version - this one loads running programs to
a visible list, will offer to "Attempt Program Close" or "Copy to
Clipboard" if ya click on it, and has options to save/refresh list.
Also has "Find" and "Find Again" feature.
__________________________________________________________________________________________________________________________
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
OPTION FIELDSEP, "="
TITLE By Mac
DIALOG CREATE,"Running Programs",-1,0,400,220
  DIALOG ADD,STYLE,S1,Courier New,10,B
  DIALOG ADD,MENU,&Actions,&Save List As...|ALT+S,-,&Refresh List|ALT+R,-,&Find|ALT+F,Find Again|F3,-,&Exit|ALT+X
  DIALOG ADD,LIST,L1,0,0,400,200,,CLICK,S1
  rem -- Add horizontal scroll to list --
  %z = @sendmsg(@winexists(~L1),$0194,2000,0)
  DIALOG ADD,STATUS,Stat,"Click to attempt program close...",S1
DIALOG SHOW

LIST CREATE, 1
GOSUB ListPrograms

:CancelMENU
:EVLOOP
  WAIT EVENT
  goto @event()

:L1CLICK
  PARSE "%%item", @item(L1)
  if @equal(%%item, "Window")@equal(%%item, "Class")@equal(%%item, "Handle")
     DIALOG POPUP,Attempt Program Close|Copy to Clipboard|-|Cancel
     %e = @event()
     if %e
        goto %e
     end
  end
  goto EVLOOP

:Copy to ClipboardMENU
  CLIPBOARD SET, @item(L1)
  goto EVLOOP

:Attempt Program CloseMENU
  if @equal(%%item, "Window")
     PARSE ";%%win", @item(L1, @sum(@index(L1), 2))
  end
  if @equal(%%item, "Class")
     PARSE ";%%win", @item(L1, @succ(@index(L1)))
  end
  if @equal(%%item, "Handle")
     PARSE ";%%win", @item(L1)
  end
  if @ask(Attempt to close this program?@cr()@cr()Warning - Do NOT close necessary system files!@tab())
     WINDOW CLOSE, %%win
     WAIT
     if @winexists(%%win)
        INFO Cannot close program...@tab()
     else
        INFO Program closed successfully...@tab()
     end
     GOSUB ListPrograms
  end
  goto EVLOOP

:Save List As...MENU
  %f = @filedlg(,,,SAVE)
  if %f
     LIST SAVEFILE, L1, %f
     WAIT
     if @file(%f)
        INFO Saved as:@cr()@cr()%f@tab()
     else
        INFO ERROR - File NOT saved...@tab()
     end
  end
  goto EVLOOP

:Refresh ListMENU
  GOSUB ListPrograms
  goto EVLOOP

:FindMENU
  %s = @input("Enter string to find (searches from top):")
  if %s
     LIST SEEK, L1, 0
     if @not(@match(L1, %s))
        INFO @chr(34)%s@chr(34)@tab()@cr()@cr()NOT found...@tab()
     end
  end
  goto EVLOOP

:Find AgainMENU
  if %s
     if @greater(@pred(@count(L1)), @succ(@index(L1)))
        LIST SEEK, L1, @succ(@index(L1))
        if @not(@match(L1, %s))
           INFO @chr(34)%s@chr(34)@tab()@cr()@cr()NOT found again...@tab()
        end
     else
        INFO @chr(34)%s@chr(34)@tab()@cr()@cr()NOT found again...@tab()
     end
  else
     goto FindMENU
  end
  goto EVLOOP

:ExitMENU
:CLOSE
  EXIT

rem ----------------- SUBS ----------------------

:ListPrograms
  LIST CLEAR, 1
  LIST CLEAR, L1
  LIST WINLIST, 1, NCI
  LIST ADD, L1, @count(1) programs running @datetime(mm/dd/yyyy hh:nn:ss am/pm)
  LIST ADD, L1, ""
  %x = 0
  REPEAT
    PARSE "%n;%c;%i", @item(1, %x)
    if @not(%n)
       %n = "unknown..."
    end
    if @not(%c)
       %c = "unknown..."
    end
    if @not(%i)
       %i = "unknown..."
    end
    LIST ADD, L1, "Window= "%n
    LIST ADD, L1, " Class= "%c
    LIST ADD, L1, "Handle= "%i
    LIST ADD, L1, ""
    %x = @succ(%x)
  UNTIL @greater(%x, @pred(@count(1)))
  exit

EDIT 1 - Added "Refresh List" and "Exit" menu items.
EDIT 2 - Added "Find" and "Find Again" menu items. Added
popup menu (on item click) to offer "Attempt Program Close"
or "Copy to Clipboard" options.

Cheers, Mac

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Mar 26, 2003 9:42 pm    Post subject: Reply with quote

Added search and copy features.
_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group