MSFN Forum: Window hider - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Window hider Rate Topic: -----

#1 User is offline   Oziyn 

  • םәąŧђ
  • Pip
  • Group: Banned
  • Posts: 69
  • Joined: 04-June 08

Posted 04 August 2009 - 10:17 AM

So what im trying to do is make a program that will minimize and rename or hide all the currently active windows on the screen.

Is this even possible?

I'm trying to make it using C++. Im a newbie and have only learned the basics but im a fast learner and will take all of your advice!

Thanks in advance,
Ozi


#2 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,116
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 04 August 2009 - 12:04 PM

Here's a small open source utility which may help or at least bring inspiration.

#3 User is offline   Oziyn 

  • םәąŧђ
  • Pip
  • Group: Banned
  • Posts: 69
  • Joined: 04-June 08

Posted 04 August 2009 - 12:58 PM

Thank you, but i guess this isn't happening for me...
Anyone out there that can help me? Anyone? :}

#4 User is offline   Glenn9999 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 588
  • Joined: 23-April 07

Posted 06 August 2009 - 10:28 AM

View PostOziyn, on Aug 4 2009, 01:58 PM, said:

Thank you, but i guess this isn't happening for me...
Anyone out there that can help me? Anyone? :}


You might want to be a bit clearer. If by "hide" you mean "minimize", then yes it can be done. However, "rename or hide" might be another matter all together and is likely not possible. If you want to find all the active windows, I can dig out a sample of that (it's in Delphi, but it's all Windows API calls anyway). Minimizing them isn't too hard to do from there once you have the window addresses.

And it's not necessarily an issue of learning C++ in this case, it's learning the Windows API. Two different things.

Okay: Samples. This gets all your window addresses.

WinAddr := GetActiveWindow;
repeat   
  WinAddr := GetNextWindow(WinAddr, GW_HWNDNEXT);
until WinAddr = 0;


This tests the kind of window address you have:
IsWindowVisible(WinAddr) - is it a visible window?
GetParent(WinAddr) <> 0 - is it the main (or parent) window?


These get text information about the window address.
GetClassName(WinAddr, ClassNamea, 256); - Class Name
GetWindowText(WinAddr, WinNamea, 256); - Window Text (what you see in the title of the window)


This gets the thread id and process id for a window address.
ThreadID := GetWindowThreadProcessID(WinAddr, @processid);


All are Windows API commands, if you want to see documentation on them, look them up on Microsoft's Developer site.

This is the one for "GetClassName", all the others will appear there as well upon search

This post has been edited by Glenn9999: 06 August 2009 - 10:47 PM


#5 User is offline   Oziyn 

  • םәąŧђ
  • Pip
  • Group: Banned
  • Posts: 69
  • Joined: 04-June 08

Posted 06 August 2009 - 10:43 PM

Hey, thanks for the response!
In "msn messenger PLUS" theres a feature where you press ctrl+space and it hides your window in your system tray as a search icon.
Thats my goal right there.

#6 User is offline   Glenn9999 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 588
  • Joined: 23-April 07

Posted 06 August 2009 - 10:49 PM

View PostOziyn, on Aug 6 2009, 11:43 PM, said:

Hey, thanks for the response!
In "msn messenger PLUS" theres a feature where you press ctrl+space and it hides your window in your system tray as a search icon.
Thats my goal right there.


With your app or anyone's app? Having a System Tray icon requires interprocess communication, which means the app in question would need to be set up to handle it. Which means it wouldn't be possible with anyone's app. Your app, however, could do it. Searching for "system tray" with respect to coding/programming should net you the answer on how to do it.

#7 User is offline   PC_LOAD_LETTER 

  • Well, I stole something else
  • Group: Super Moderator
  • Posts: 1,829
  • Joined: 13-October 07
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 06 August 2009 - 10:52 PM

The wonderful icon can do this and the autor has some code at the bottom of this faq
http://www.thewonder...n.com/faqs.html

#8 User is offline   Oziyn 

  • םәąŧђ
  • Pip
  • Group: Banned
  • Posts: 69
  • Joined: 04-June 08

Posted 07 August 2009 - 08:08 AM

Thank you guys!
Now i have some of the stuff i need. What about the icon? How would i choose what it looks like? and make all my windows re-open when i double click it?

#9 User is offline   Glenn9999 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 588
  • Joined: 23-April 07

Posted 07 August 2009 - 10:09 AM

View PostOziyn, on Aug 7 2009, 09:08 AM, said:

Thank you guys!
Now i have some of the stuff i need. What about the icon? How would i choose what it looks like? and make all my windows re-open when i double click it?


ShowWindow would be what you would need to control the windows, as the link indicated. The icon is set through the systray notification API routine. This is in Delphi, but again it's just nothing but Windows API calls that you can look up on the site I mentioned. It shows my app setting up a systray icon.

 
  with TrayIconData do
  begin
    cbSize := SizeOf(TrayIconData);
    Wnd := Handle;
    uID := 0;
    uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP;
    uCallbackMessage := WM_ICONTRAY;
    hIcon := Application.Icon.Handle;  // get the icon if the app.
    StrPCopy(szTip, Application.Title);
  end;
  Shell_NotifyIcon(NIM_ADD, @TrayIconData);
 


You could realistically do this for each app you would control as the other link described (wasn't too sure of the API to say you could do it in my last post, but I'm very sure now you could completely hide windows and control them through a systray icon), but you would have to keep track of them and keep a handler set up for each one. All control of icons go through Shell_NotifyIcon, either NIM_ADD, NIM_MODIFY, or NIM_DELETE.

However, I'm not sure you could make a systray icon respond by an expressed double-clicking it, since it seems to respond only to single mouse-clicks. Generally you would then start a popup menu at the systray icon.

Speaking of this, now that I see all of what is required to run windows through a systray icon, I might go try it myself. What may be interesting is if you can modify the standard system menu to include an option to "minimize to tray" or the like. Let me know if you have any more specific questions.

#10 User is offline   Oziyn 

  • םәąŧђ
  • Pip
  • Group: Banned
  • Posts: 69
  • Joined: 04-June 08

Posted 07 August 2009 - 12:46 PM

Actually, that sounds pretty interesting. Maybe we could team up and make something with all of our ideas put together?
PM me if your interested.

#11 User is offline   Glenn9999 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 588
  • Joined: 23-April 07

Posted 08 August 2009 - 06:33 PM

View PostGlenn9999, on Aug 7 2009, 11:09 AM, said:

Speaking of this, now that I see all of what is required to run windows through a systray icon, I might go try it myself.


I just finished writing the basic idea of what I was typing of here (minimize windows to systray, restore them, and so forth). I'm not sure it would be worth releasing the source for it, yet. But my main question to those in group is if there any demand for something like this? If so, I might go ahead and release the app itself as a beta test when it's ready...

#12 User is offline   Glenn9999 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 588
  • Joined: 23-April 07

Posted 12 August 2009 - 11:40 AM

An interesting side effect: You can hide all the icons at will on the desktop if you minimize "Program Manager". :)

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy