How to hide multiple windows with the same name ???

This is a discussion on How to hide multiple windows with the same name ??? within the Windows Programming forums, part of the Platform Specific Boards category; Hello , I have a small problem for you experts When I start 3,4 ... etc ... Half Life dedicated ...

  1. #1
    Registered User
    Join Date
    May 2014
    Posts
    4

    Question How to hide multiple windows with the same name ???

    Hello , I have a small problem for you experts

    When I start 3,4 ... etc ... Half Life dedicated servers that are called the same name "Console" I want that my program to hide them all from taskbar , but my program actualy hide only one window (the first opened)

    Ver 1:

    Code:
    #define _WIN32_WINNT 0x0500
    
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    void show();
    void hide();
    
    
    int main()
    {
        int optiune;
        
        SetConsoleTitle("Ascunde redirecte");
    
        do
        {
         cin>>optiune;
         switch(optiune)
         {
          case 1:
               show();
               break;
          case 2:
               hide();
               hide();
               break;
         }
        }while(optiune!=0);
        
        show();
        
        return 0;
    }
    
    void show()
    {
        HWND hWnd = FindWindow(0,"Console");
        
        if(hWnd!=0)
        {
                   ShowWindow(hWnd,SW_SHOW);      
        }
    }
    
    void hide()
    {
        HWND hWnd = FindWindow(NULL,"Console"); 
        
        if(hWnd!=0)
        {  
                  ShowWindow(hWnd,SW_HIDE);           
        }
    }
    Ver2:

    Code:
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    int main()
    {    
        HWND WindowHandel = FindWindow(0, "Console");
        
        DWORD proccesID = 0;
        GetWindowThreadProcessId(WindowHandel, &proccesID);
    
        cout <<proccesID<<endl;
        system("pause");
    }
    Can anyone give me the solution for this ? I don`t care what function you will use ...

    I know that this is simple for you guys

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    2,407
    1. This looks more like a windows programming question than a C++ question.

    2. This looks suspiciously like a prelude to a hacking attempt. You will not receive help with hacking on this site.

    3. We will not give you a solution. We may help you find one for yourself. If it was simple, you could do it yourself.
    Code:
    namespace life
    {
        const bool change = true;
    }

  3. #3
    Registered User
    Join Date
    May 2014
    Posts
    4
    Quote Originally Posted by Elkvis View Post
    1. This looks more like a windows programming question than a C++ question.

    2. This looks suspiciously like a prelude to a hacking attempt. You will not receive help with hacking on this site.

    3. We will not give you a solution. We may help you find one for yourself. If it was simple, you could do it yourself.
    HACKING ???????? )))) man , I want to open 20 servers and hide them because I don`t want to see them on the taskbar , what hacking ? this is a good one ))

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    2,407
    You wanna know how this looks like hacking? Fine, I'll indulge your skepticism.

    Hackers often covertly install software on users' computers that spawns other programs, which appear in new windows. In an attempt to prevent the user from noticing this, they will try to programmatically hide the window. It is a very common hacking technique, and all requests for such information must, according to the rules of this forum, be treated with a great deal of caution.
    Code:
    namespace life
    {
        const bool change = true;
    }

  5. #5
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    1,063
    Be that as it may, I think the Half Life dedicated servers are used for Steam and its older games and stuff, right?

  6. #6
    Registered User
    Join Date
    May 2014
    Posts
    4
    Quote Originally Posted by Elkvis View Post
    You wanna know how this looks like hacking? Fine, I'll indulge your skepticism.

    Hackers often covertly install software on users' computers that spawns other programs, which appear in new windows. In an attempt to prevent the user from noticing this, they will try to programmatically hide the window. It is a very common hacking technique, and all requests for such information must, according to the rules of this forum, be treated with a great deal of caution.

    By your mind this forum can be closed tomorow ! , here is a Example

    Don`t ask nothing about sockets because you can use that information to make (flood , scan , etc ...) . Give me a break man ... you are responsible for what are you doing ... after you found something ... I did not ask for any hack or something , so your are 100% wrong to say something about hacking here ...


    And for MutantJohn , Counter Strike man ... HLDS = Half Life dedicated server = Counter Strike server . When you open them the names are the same "Console" , only the PID is different ...
    Last edited by bubi; 05-06-2014 at 11:04 AM.

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,717
    *moved to Windows programming forum*
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    Registered User
    Join Date
    Oct 2006
    Posts
    2,407
    you might consider using the EnumWindows function
    Code:
    namespace life
    {
        const bool change = true;
    }

  9. #9
    Registered User
    Join Date
    May 2014
    Posts
    4
    10x Elkvis , I have made it.

    Code:
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    BOOL CALLBACK EnumWindowsProc(HWND hWnd,LPARAM lParam)
    {
         DWORD dwThreadId, dwProcessId;
         HINSTANCE hInstance;
         char window_name[255];
         HANDLE hProcess;
         
         if(!hWnd)
         {
          return true; // nu e window
         }
         //if(!::IsWindowVisible(hWnd))
         //{
          //return true; // nu e vizibila fereastra
         //}
         if(!SendMessage(hWnd,WM_GETTEXT,sizeof(window_name),(LPARAM)window_name))
         {
          return true; // nu are titlu fereastra
         }
         
         hInstance = (HINSTANCE)GetWindowLong(hWnd,GWL_HINSTANCE);
         dwThreadId = GetWindowThreadProcessId(hWnd,&dwProcessId);
         hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,dwProcessId);
         
         if(strcmp(window_name,"Console")==0)
         {
          cout<<hWnd<<" "<<dwProcessId<<"\t"<<window_name<<"\t"<<endl;
          ShowWindow(hWnd,SW_HIDE); 
         }
          
         CloseHandle(hProcess);
         return true;
    }
    
    int main()
    {
        EnumWindows(EnumWindowsProc,NULL);
        system("pause");
        return 0;
    }
    Close this topic

  10. #10
    Registered User
    Join Date
    Oct 2006
    Posts
    2,407
    Topics on this forum don't get "closed" per se. You have written a program to hide the windows. What's stopping you from writing a program that launches all of the dedicated servers, without opening consoles for all of them?
    Code:
    namespace life
    {
        const bool change = true;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trying to hide all windows of msn
    By elwad in forum Windows Programming
    Replies: 1
    Last Post: 05-27-2009, 04:44 PM
  2. Multiple Windows
    By napalm in forum C Programming
    Replies: 5
    Last Post: 04-25-2008, 04:02 AM
  3. How to Hide Cursor in one of the Splitter Windows?
    By kevin_cat in forum Windows Programming
    Replies: 1
    Last Post: 06-24-2005, 01:57 PM
  4. Multiple windows.
    By Rare177 in forum Windows Programming
    Replies: 1
    Last Post: 09-30-2004, 06:58 AM
  5. multiple windows
    By rlee in forum C++ Programming
    Replies: 1
    Last Post: 03-25-2003, 06:27 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21