Page 1 of 1

LaunchTaskManager procedure

Posted: Wed Mar 08, 2006 11:58 am
by PB
Code updated For 5.20+

Okay doodlemunch, you owe me $100 for this... I just spent all night on this
problem for you! ;) Hope it makes all your dreams come true.

Code: Select all

; LaunchTaskManager by PB.

; I had the idea of CTRL+ALT+DEL for Win 95/98/ME, but it never worked.
; Then I found the following Usenet post by SleazySt that held the secret!
; You need to do the keystrokes to any console window! :) Thanks, SleazySt!
; http://groups.google.com/group/comp.os.ms-windows.programmer.win32/msg/3346a81034c9c2ea

; For the curious: tty = Console class name for Win 95/98/ME.  In the Usenet post above,
; SleazySt just does "SetForegroundWindow_(FindWindow_("tty",0))" but this assumes that
; a console window already exists.  Since this isn't always the case, I create one first
; and then find its class so that CTRL+ALT+DEL can successfully be typed onto it. ;)
; This is superior to just searching for a window called "MS-DOS Prompt" because such a
; window will likely have a different title on different languages of Windows.

Procedure LaunchTaskManager()
  Select OSVersion()
    Case #PB_OS_Windows_95,#PB_OS_Windows_98,#PB_OS_Windows_ME
      RunProgram("command.com","","",#PB_Program_Hide)
      Repeat : Sleep_(1) : dos=FindWindow_("tty",0) : Until dos<>0
      Sleep_(100) : SetForegroundWindow_(dos) ; Delay seems necessary.
      keybd_event_(#VK_CONTROL,MapVirtualKey_(#VK_CONTROL,0),0,0)
      keybd_event_(#VK_MENU,MapVirtualKey_(#VK_MENU,0),0,0)
      keybd_event_(#VK_DELETE,MapVirtualKey_(#VK_DELETE,0),0,0)
      keybd_event_(#VK_DELETE,MapVirtualKey_(#VK_DELETE,0),#KEYEVENTF_KEYUP,0)
      keybd_event_(#VK_MENU,MapVirtualKey_(#VK_MENU,0),#KEYEVENTF_KEYUP,0)
      keybd_event_(#VK_CONTROL,MapVirtualKey_(#VK_CONTROL,0),#KEYEVENTF_KEYUP,0)
      SendMessage_(dos,#WM_CLOSE,0,0) ; Otherwise "Winoldap" stays in Task Manager.
    Default ; NT-based systems (NT, 2000, XP).
      ShellExecute_(0,0,"taskmgr.exe","","",#SW_SHOW)
  EndSelect
EndProcedure

LaunchTaskManager()

Posted: Wed Mar 08, 2006 5:08 pm
by doodlemunch
thank u a lot!!!!!!!!!!!
i see it was possibel !
and i like 9x even if its old ppl uses it and i think it shuld be supportet by soft developrs !!