Click here to Skip to main content
6,597,576 members and growing! (20,501 online)
Email Password   helpLost your password?
Web Development » Applications & Tools » Tools with source code     Intermediate

Window Unhidder

By JJimenezShaw

A utility to list and hide/unhide all application windows.
VC6, Windows, MFC, Dev
Posted:14 Feb 2006
Views:20,467
Bookmarked:33 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
16 votes for this article.
Popularity: 5.28 Rating: 4.39 out of 5
1 vote, 6.3%
1

2

3
2 votes, 12.5%
4
13 votes, 81.3%
5

Window Unhidder

Introduction

This program allows the user to hide-unhide any window that is running on the system. It also gives interesting information about programs' activities. Many programs use hidden windows, that sometimes may cause problems. With WindowUnhidder, you can hide-unhide, enable/disable any window, and get information about process, title, class, parent window, exec path, etc.

Background

The first aim of this program was to find and unhide some windows. Once done, I saw that it could be useful to show all info I can get.

Using the code

The program is ready for use. Most part of the code is in the class CWindowUnhidderDlg. I know that some more classes could be implemented, but at the beginning it was a little app, and it was not necessary.

The part of the code where windows are searched for is shown here:

    //

    // search windows:

    char title[512], titlepadre[512], clase[100];
    HWND mWnd = NULL;
    HWND mWndPad = NULL;
    HWND mWndSys = NULL;
    mWnd = ::FindWindowEx(NULL,mWnd,NULL,NULL);

    int ii=0;
    while ( mWnd )
    {
        ::GetWindowText(mWnd, title, 256);
        ::GetClassName(mWnd, clase, 100);
        CString vis = ::IsWindowVisible(mWnd)?'1':'0';
        CString ena = ::IsWindowEnabled(mWnd)?'1':'0';

        CString Cadena = "";
        mWndPad = mWnd;
        CString TitPad = "";
        memset(titlepadre,0,512);
        do
        {
            mWndPad = ::GetParent(mWndPad);
            if (mWndPad)
                if(m_ParentHandler.GetCheck()!=0)
                    sprintf(titlepadre,"#%X",mWndPad);
                else
                    ::GetWindowText(mWndPad, titlepadre, 256);
            TitPad = titlepadre;
            TitPad.TrimRight();
            Cadena = CString(mWndPad?CString((TitPad=="")? 
                     "[no title]":TitPad):"[Desktop]") + 
                     CString(" :: ") + Cadena;
        }
        while (mWndPad);

        
        CString Tit = title;
        if(Tit=="")Tit="[no title]";
        
        DWORD wd=0;
        GetWindowThreadProcessId(mWnd,&wd);
        stringstream ss,ssw;
        ss << wd;
        CString proc;
        bool full = m_FullPath.GetCheck() != 0;
        proc = GetProcessName(wd,full);

        int col=0;
        ssw << "#" << uppercase << hex << (int)mWnd;
        m_List.AddItem(ii,col++,ssw.str());
        m_List.AddItem(ii,col++,ss.str());
        m_List.AddItem(ii,col++,proc);
        m_List.AddItem(ii,col++,vis);
        m_List.AddItem(ii,col++,ena);
        m_List.AddItem(ii,col++,Tit);
        m_List.AddItem(ii,col++,clase);
        m_List.AddItem(ii,col++,Cadena);
        m_List.SetItemData(ii,DWORD(mWnd));

        ii++;

        mWnd = ::GetNextWindow(mWnd,GW_HWNDNEXT);
    }
    //

Points of Interest

It is interesting to see how some programs use hidden windows. I found a funny trick: try to hide the windows (you can sort the columns) with the class "Progman" or "Shell_TrayWnd"... you will see what happens with the desktop!

History

Thanks to Hugo Gonzalez Castro for his help.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

JJimenezShaw


Member
Javier Jimenez Shaw. Born in Madrid in 1975. Civil engineer, is working developing financial algorithms for exotic products.
Occupation: Software Developer (Senior)
Location: Spain Spain

Other popular Applications & Tools articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 6 of 6 (Total in Forum: 6) (Refresh)FirstPrevNext
QuestionGreat Job! PinmemberBitterstamps19:44 5 Jun '07  
AnswerRe: Great Job! PinmemberJJimenezShaw4:23 6 Jun '07  
GeneralSpelling Pinmemberhain13:00 21 Feb '06  
GeneralRe: Spelling PinmemberJJimenezShaw13:36 21 Feb '06  
GeneralOther tool... PinmemberDuneAgent12:00 21 Feb '06  
GeneralGood work! PinmemberPaul S. Vickery23:22 16 Feb '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 14 Feb 2006
Editor: Smitha Vijayan
Copyright 2006 by JJimenezShaw
Everything else Copyright © CodeProject, 1999-2009
Web16 | Advertise on the Code Project