Jump to content

Window hider


Recommended Posts

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

Link to comment
Share on other sites


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

Edited by Glenn9999
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...