Jump to content
Sign in to follow this  
BillLuvsU

Hide all windows

Recommended Posts

BillLuvsU

Hey, me again. Does anybody know how to hide a window by using it's handle, like with WinSetState? Basically I'm trying to hide all windows (from "winlist( )"), to "lock" the computer. If I'm right this should also hide all icons, task bar and everything thing else, right? o_0. I'm way out of practice at this xD


[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites
Richard Robertson

Opt("WinTitleMatchMode", 4) lets you use handles I think. I always check the help file when I write programs.

You should be able to pass the handle to WinSetState. Just make sure you keep a list of the windows you hide. It'd be a mess to show all windows.

Share this post


Link to post
Share on other sites
ssubirias3

I'm trying to hide all windows (from "winlist( )"), ...

I don't think WinSetState($hwnd,"",@SW_HIDE) will keep WinList() from putting it in the array. I could be wrong, but this is what the Help file shows as an example. Note the "AND IsVisible" if WinList didn't see hidden windows too, this would be a waste, right?? Oh and welcome back Mr 4,044;)

$var = WinList()

For $i = 1 to $var[0][0]
  ; Only display visble windows that have a title
  If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
    MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
  EndIf
Next

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf

EndFunc
Edited by ssubirias3

Share this post


Link to post
Share on other sites
BillLuvsU

Ya, thats what I want. i'm writing a security program cause I discovered my parents had done somthing on my laptop when I wasn't around and I had some very sensitive chat windows open. Its also an idea I've had for awhile, but havn't been able to attempt. And ya, I have been here for awhile havn't I? Thanks alot for that tip Richard, I din't evan think to check in the options section, but did look through the help file =]

Edit: Ok, thats for classnames but I don't see anything about handles...

Advanced Window Descriptions

A special description can be used as the window title parameter. This description can be used to identify a window by the following properties:

TITLE - Window title

CLASS - The internal window classname

REGEXPTITLE - Window title using a regular expression (if the regular expression is wrong @error will be set to 2)

LAST - Last window used in a previous AutoIt command

ACTIVE - Currently active window

INSTANCE - The 1-based instance when all given properties match

Edited by fear1313

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites
ssubirias3

Ya, thats what I want. i'm writing a security program cause I discovered my parents had done somthing on my laptop when I wasn't around and I had some very sensitive chat windows open. Its also an idea I've had for awhile, but havn't been able to attempt. And ya, I have been here for awhile havn't I? Thanks alot for that tip Richard, I din't evan think to check in the options section, but did look through the help file =]

Edit: Ok, thats for classnames but I don't see anything about handles...

Option 4 = Advanced mode, see Window Titles & Text (Advanced). You didn't scroll down far enough to see the "Window Handles / HWNDs" title of that page :).

About your ParentBlocker script, would something like calling the screensaver then using BlockInput(1)? You of course would need to set up a HotKetSet() so you can turn things back on with a BlockInput(0). Just food for thought.

Share this post


Link to post
Share on other sites
BillLuvsU

Oh my god -.-;

Note: Window handles will work no matter what WinTitleMatchMode is currently in use.

*anime flip fall thing*

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites
ssubirias3

:) touché my friend .... touché. But that doesn't mean what Richard and I were telling were was "wrong", ya know?? I was telling you were you could find the info on handles (on the advanced page) since you said you couldn't find any info on them. I don't know about Richard, but I thought everything on the Advanced page would require 4. All I ever use is Opt("WinTitleMatchMode", 4) and its good to know that handles work with any WinTitleMatchMode.

Regardless, its pretty cool we can all have fun and learn something new :).

Share this post


Link to post
Share on other sites
therks

I will warn you now, be careful when you are un-hiding the windows. Don't think that you can just get away with just showing everything that WinList gives you because there are a lot of windows that are hidden for good reason, and are not meant to be shown. I know from experience, so trust me. :)

Your best bet is to get your WinList, and as you're cycling through the results, keep track of every visible window in a separate array as you hide them, then use that array when you "restore" your windows. Also be careful though, if your program crashes or ends for whatever reason before you restore these windows, you won't really have any way of telling which windows used to be shown and which ones are supposed to stay hidden. You can try and prepare for this by maybe having it dump the array to a file or something.

Just some advice. I tried once to make an April fools script for my mom that appeared just like the WinXP "lock computer" dialog. I set it up with user/pass fields and just had it tell her that she had the wrong password. Then after so many tries it was like, "Deleting your files..." and then it popped up with "Haha April fools!" and THEN it was supposed to restore all the windows... but I had an error in the script or something and it crashed leaving me with a blank desktop, and umpteen hidden windows. Not so fun... And mom wasn't very impressed either for some reason. :)

Share this post


Link to post
Share on other sites
maqleod

I wrote a program that included a function to hide/show windows, it kept track of hidden window handles in a registry key, not the most ideal, but its a safe place to store the data in case the script does crash.


[u]You can download my projects at:[/u] Pulsar Software

Share this post


Link to post
Share on other sites
BillLuvsU

Thanks for the tips, but I'm being careful. =] And what do you mean hidden for good reason?


[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites
qazwsx

if you really want to use winlist and then show all windows. It wont hurt your computer but u will probably have to resart. I think most processes have a window most of them are just hidden.

Share this post


Link to post
Share on other sites
therks

Well, I don't know if "for good reason" was the right way to put it, but I experienced problems when I just un-hid every window I could find. Especially with tooltips, often when I tried to show a tooltip, the tip itself wouldn't appear, but the shadow would. I believe Valik explained to me once that the shadow is actually it's very own window (class: SysShadow), and it gets created everytime a tooltip becomes visible, and gets closed/destroyed when the tooltip would auto hide. But since the tooltip wasn't appearing via normal routines, the shadow gets left behind, and you have this weird looking thing on your screen. There are also lots of other windows that just shouldn't be appearing manually, like drop-down lists for combo boxes. Winamp has a bunch of windows that are supposed to stay hidden as well, and it gets all glitchy if you show them.

I made this program, WinLister (compiled/source), if you want to have a look, it lists all the windows that can be found, and a bunch of stats about them (classname, process, coords). You can filter the list by clicking on the heading buttons in the listview.

Share this post


Link to post
Share on other sites
BillLuvsU

Ok, I'll play with that, thanks! :)


[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites
ZeeDream

Great one, but I just need more help in that

Is it possible to create a process list so you can hide / show / maximize / minimize .. etc

and more if I can filter the list so get definite process name

it will help me a lot in my online games to reduce Ram usage^^

and thanks in advance.

Share this post


Link to post
Share on other sites
guinness

1. This thread is 4 years old!

2. Read this to understand why your question is unlikely to get an answer >> http://www.autoitscript.com/forum/forum-2/announcement-13-forum-rules/


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
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
Sign in to follow this  

×