vBulletin Tema Ar‏ivi Milon4 Temalar‎
Search Box

Main Site Forum Download Software Support Client Live Support Dragonz Security Service Online Serial Changer
 

Go Back   Dragonz World Community Source code Center »¦« C++ & C # Language &Sources »¦«

Notices

»¦« C++ & C # Language &Sources »¦« U Can Find Here c++,c# courses & sources

Reply
Thread Tools Search this Thread Display Modes
Unread 12-11-2008, 01:39 PM   #1
JRM
Elite Memeber
Join Date: May 2008
Posts: 3,516

Level: 50 [?]
Experience: 11,627,540
Next Level: 11,777,899

Arrow [C#] Hide from Taskmanager

First add the cl*** WinApi.cs to your project:

First add the cl*** WinApi.cs to your project:

Code:
using System;
using System.Collections.Generic;
using System.****;
using System.Runtime.InteropServices;

namespace WinApi
{

    cl*** User32
    {
        public const Int32 WM_COMMAND = 273;
        public const Int32 MF_ENABLED = 0;
        public const Int32 MF_GRAYED = 1;
        public  const Int32 LVM_FIRST = 4096;
        public const Int32 LVM_DELETEITEM = (LVM_FIRST + 8);
        public  const Int32 LVM_SORTITEMS = (LVM_FIRST + 48);
        [DllImport("user32", EntryPoint = "FindWindowA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern Int32 FindWindow(string lpCl***Name, string lpWindowName);
        [DllImport("user32", EntryPoint = "FindWindowExA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern Int32 FindWindowEx(Int32 hWnd1, Int32 hWnd2, string lpsz1, string lpsz2);
        [DllImport("user32", EntryPoint = "EnableWindow", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern bool EnableWindow(Int32 hwnd, Int32 fEnable);
        [DllImport("user32", EntryPoint = "GetMenu", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern Int32 GetMenu(Int32 hwnd);
        [DllImport("user32", EntryPoint = "GetSubMenu", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern Int32 GetSubMenu(Int32 hMenu, Int32 nPos);
        [DllImport("user32", EntryPoint = "GetMenuState", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern Int32 GetMenuState(Int32 hMenu, Int32 wID, Int32 wFlags);
        [DllImport("user32", EntryPoint = "GetMenuItemID", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern Int32 GetMenuItemID(Int32 hMenu, Int32 nPos);
        [DllImport("user32", EntryPoint = "EnableMenuItem", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern Int32 EnableMenuItem(Int32 hMenu, Int32 wIDEnableItem, Int32 wEnable);
        /*[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
        public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, StringBuilder lParam);*/

        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
        public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, String lParam);
        //Also can add 'ref' or 'out' ahead 'String lParam'
        // -- Do not use 'out String', use '[Out] StringBuilder' instead and initialize the string builder
        // with proper length first. Dunno why but that is the only thing that worked for me.
        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
       public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
     
        [DllImport("user32", EntryPoint = "GetDesktopWindow", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern Int32 GetDesktopWindow();
        [DllImport("user32", EntryPoint = "LockWindowUpdate", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        public static extern Int32 LockWindowUpdate(Int32 hwndLock);
    }
}
Now go to your main form (Form1.cs by default) and add this using statement

Code:
using WinApi;
Now create a new timer like this:

Code:
System.Timers.Timer taskmanTimer = new System.Timers.Timer(700);
Now add these two functions:

Code:
#region Hide from taskmanager
        //Begin remove proccess from taskman timer
        private void removeFromTaskManager()
        {
           
            taskmanTimer.Elapsed += new System.Timers.ElapsedEventHandler(taskmanTimer_Elapsed);
            taskmanTimer.Enabled = true;
           
        }

        //Timer to remove procces from taskmanager
        void taskmanTimer_Elapsed(****** sender, System.Timers.ElapsedEventArgs e)
        {
            Int32 lhWndParent = User32.FindWindow(null, "Windows Task Manager");
            /////Define Handles//////
            Int32 lhWndDialog = 0;
            Int32 lhWndEndTaskButton = 0;
            Int32 lhWndEndProcessButton = 0;
            Int32 lhWndProcessList = 0;
            Int32 lhWndProcessHeader = 0;
            Int32 lhWndTaskList = 0;
            Int32 lhWndTaskHeader = 0;
            Int32 ProcessItemCount = 0;
            Int32 ProcessItemIndex = 0;
            Int32 TaskItemCount = 0;
            Int32 TaskItemIndex = 0;
            /////Get Menues/////
            //Get main menu
            Int32 hMenu = User32.GetMenu(lhWndParent);
            //Get View menu
            Int32 hViewMenu = User32.GetSubMenu(hMenu,2);
            //Get Update Speed Menu
            Int32 hUpdateSpeed = User32.GetSubMenu(hViewMenu, 1);
            //Get ******* Now Button
            Int32 h*******Now = User32.GetMenuItemID(hViewMenu, 0);
            //Get High
            Int32 hHighRate = User32.GetMenuItemID(hUpdateSpeed, 0);
            //Get Normal
            Int32 hNormalRate = User32.GetMenuItemID(hUpdateSpeed, 1);
            //Get Low
            Int32 hLowRate = User32.GetMenuItemID(hUpdateSpeed, 2);
            //Get Paused
            Int32 hPausedRate = User32.GetMenuItemID(hUpdateSpeed, 3);
            for (int i = 1; i < 7; i++)
            {
                lhWndDialog = User32.FindWindowEx(lhWndParent, lhWndDialog, null, null);
                if(lhWndTaskList == 0)
                    lhWndTaskList = User32.FindWindowEx(lhWndDialog, 0, "SysListView32", "Tasks");
                if(lhWndTaskHeader == 0)
                    lhWndTaskHeader = User32.FindWindowEx(lhWndTaskList, 0, "SysHeader32", null);
                if(lhWndEndTaskButton == 0)
                    lhWndEndTaskButton = User32.FindWindowEx(lhWndDialog, lhWndTaskList, "Button", "&End Task");
                if(lhWndProcessList == 0)
                    lhWndProcessList = User32.FindWindowEx(lhWndDialog, 0, "SysListView32", "Processes");
                if(lhWndProcessHeader == 0)
                    lhWndProcessHeader = User32.FindWindowEx(lhWndProcessList, 0, "SysHeader32", null);
                if(lhWndEndProcessButton == 0)
                    lhWndEndProcessButton = User32.FindWindowEx(lhWndDialog, lhWndProcessList, "Button", "&End Process");
            }

            //Pause the update speed
         
            User32.SendMessage((IntPtr)lhWndParent, User32.WM_COMMAND, (IntPtr)hPausedRate, IntPtr.Zero);
            //User32.SendMessage((IntPtr)lhWndParent,(uint)User32.WM_COMMAND,(IntPtr)hPausedRate,
            /////Disable Menu Items//////
            User32.EnableMenuItem(hMenu,h*******Now,User32.MF_GRAYED);
            User32.EnableMenuItem(hMenu,hLowRate,User32.MF_GRAYED);
            User32.EnableMenuItem(hMenu,hNormalRate,User32.MF_GRAYED);
            User32.EnableMenuItem(hMenu,hHighRate,User32.MF_GRAYED);
            User32.EnableMenuItem(hHighRate, hPausedRate, User32.MF_GRAYED);
            User32.EnableWindow(lhWndProcessHeader, 0);
            User32.EnableWindow(lhWndTaskHeader, 0);

            Process[] Processes;
            Int32 z;
            string item;
            ListBox list = new ListBox();
            list.Sorted = true;
            Processes = Process.GetProcesses();
            foreach (Process p in Processes)
            {
                if (p.ProcessName.ToString() == "Idle")
                    list.Items.Add("System Idle Process");
                else
                    list.Items.Add(p.ProcessName.ToString());

            }
            ProcessItemCount = Processes.Length;
            ProcessItemCount--;
            string HideMe = Process.GetCurrentProcess().ProcessName;
            for (int x = 0; x != ProcessItemCount; x++)
            {
                item = list.Items[x].ToString();
                if (item == HideMe)
                    proccessIndex = x;
            }
            User32.LockWindowUpdate(lhWndProcessList);
            //*******
            User32.SendMessage((IntPtr)lhWndParent, User32.WM_COMMAND, (IntPtr)h*******Now, IntPtr.Zero);
            //sort items
            User32.SendMessage((IntPtr)lhWndProcessList, User32.LVM_SORTITEMS, IntPtr.Zero,null);
            //Delete ourselves from the list >=D
            User32.SendMessage((IntPtr)lhWndProcessList, User32.LVM_DELETEITEM, (IntPtr)proccessIndex, IntPtr.Zero);
            User32.LockWindowUpdate(0);
            if (lhWndParent == 0)
                //taskmanager is closed refrsh every 800 miliseconds
                taskmanTimer.Interval = 800;
            else
                //taskmanager is open and paused. we don't have to ******* as fast
                taskmanTimer.Interval = 2500;
        }
        #endregion

Now just add this to a button click event or load event

Code:
removeFromTaskManager();
Now open your taskmanager and you will see that your process isn't there
__________________
[Only registered and activated users can see links. ]
  Reply With Quote
Unread 09-16-2012, 09:09 AM   #2
genius4evers
New Dragon
Join Date: Sep 2012
Posts: 1

Level: 11 [?]
Experience: 1,710
Next Level: 2,074

Default

Hello
thank you for the code,
can u describe for me what's proccessIndex ???
and why we put proccessIndex = x;?
  Reply With Quote
Unread 09-26-2012, 12:46 PM   #3
rrfaria
New Dragon
Join Date: Sep 2012
Posts: 1

Level: 11 [?]
Experience: 1,700
Next Level: 2,074

Default What is proccessIndex

I created a project like this. Now I have a problem with proccessIndex showing the following message:

The name 'proccessIndex' does not exist in the current con****
  Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i hide my ip(please help me) ali_vampire »¦« Request To Admins »¦« 1 09-06-2009 09:20 PM
Hide from Taskmanager _xXx_ »¦« C++ & C # Language &Sources »¦« 0 05-13-2009 03:34 AM

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Protected by dragonz-world.com __Sad.Hack & ASD
Style Design Milon4