LxP Posted July 29, 2005 Share Posted July 29, 2005 Hi guys,I am trying to invoke the Full Screen option of my PuTTY window when it starts (system menu > Full Screen). I have tried this instruction:WinMenuSelectItem("numbat.cs.rmit.edu.au - PuTTY", "", "", "&Full Screen")leaving the first Item parameter blank for lack of a better idea, but it's not working. Is there a special token to signify the system menu or should this be working for me?(For what it's worth, I can send a key combination to achieve the same effect but WinMenuSelectItem() can work on windows without focus, making it a better option if possible.) Link to comment Share on other sites More sharing options...
AutoChris Posted July 29, 2005 Share Posted July 29, 2005 (edited) Hi guys,I am trying to invoke the Full Screen option of my PuTTY window when it starts (system menu > Full Screen). I have tried this instruction:WinMenuSelectItem("numbat.cs.rmit.edu.au - PuTTY", "", "", "&Full Screen")leaving the first Item parameter blank for lack of a better idea, but it's not working. Is there a special token to signify the system menu or should this be working for me?(For what it's worth, I can send a key combination to achieve the same effect but WinMenuSelectItem() can work on windows without focus, making it a better option if possible.)<{POST_SNAPBACK}>If sending keys works, why not just use ControlSend() to send keystrokes to the window even if it is not active? Edited July 29, 2005 by SerialKiller Link to comment Share on other sites More sharing options...
seandisanti Posted July 29, 2005 Share Posted July 29, 2005 Hi guys,I am trying to invoke the Full Screen option of my PuTTY window when it starts (system menu > Full Screen). I have tried this instruction:WinMenuSelectItem("numbat.cs.rmit.edu.au - PuTTY", "", "", "&Full Screen")leaving the first Item parameter blank for lack of a better idea, but it's not working. Is there a special token to signify the system menu or should this be working for me?(For what it's worth, I can send a key combination to achieve the same effect but WinMenuSelectItem() can work on windows without focus, making it a better option if possible.)<{POST_SNAPBACK}>sorry, stupid question that doesn't really help anything here, i'm just curious why you would want to full screen a window without giving it focus? Link to comment Share on other sites More sharing options...
LxP Posted July 30, 2005 Author Share Posted July 30, 2005 I do want my full-screen window to be focussed; however if for some reason my window doesn't receive focus when it opens, I would still like the Full Screen command to be effective without having to ensure that it is focussed.Basically if there's a way to access standard menu items of an unfocussed window then surely there should be a way to access system menu items? (Of course generally there's not much need because most of the items within can be done with AutoIt functions.) Link to comment Share on other sites More sharing options...
LxP Posted July 30, 2005 Author Share Posted July 30, 2005 (edited) If sending keys works, why not just use ControlSend() to send keystrokes to the window even if it is not active?<{POST_SNAPBACK}>Thanks for the suggestion but the window doesn't appear to have any controls within it according to AutoIt Window Info (edit: this output is the same no matter where I place the mouse):>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<Size:Control ID:ClassNameNN:Text:and ControlSend() mandatorily wants a ControlID parameter. Edited July 30, 2005 by LxP Link to comment Share on other sites More sharing options...
LxP Posted July 30, 2005 Author Share Posted July 30, 2005 I've just discovered that the key combination is no longer an option -- I have to disable it because it interferes with my session. As there is no program option to start the session in full-screen mode, I can only activate the appropriate system menu item which is not doable by keyboard. Anyone who can offer a solution will be greatly appreciated! Link to comment Share on other sites More sharing options...
LxP Posted August 4, 2005 Author Share Posted August 4, 2005 -- Bump!I try to avoid bumping topics but I'm facing a hindrance without the ability to WinMenuSelectItem() a system menu entry.Is there currently a way to achieve this with the existing syntax? If not, is it likely that this ability could be added without much difficulty?I'm avoiding a cross-post to the Idea Lab but if anyone thinks that it would help then I'll hold off no longer. Link to comment Share on other sites More sharing options...
Zedna Posted August 4, 2005 Share Posted August 4, 2005 If there is no standard solution then you could try some DllCall stuff. I think it's possible to simulate this command by SendMessage with specific command. Question is what command is it. There are some programs to check messages sent by windows: - Girder 3.1 (free) - Borland WinSight (not free) - ... ? Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
LxP Posted August 5, 2005 Author Share Posted August 5, 2005 Thanks very much Zedna -- I used Winspector to determine that I want to send a WM_SYSCOMMAND with wParam 0x180 to the window (apparently the system menu sends WM_SYSCOMMAND messages and not WM_COMMAND ones, which is why I've had so much trouble in the past it seems).Could you please tell me more about this SendMessage() functionality? I'm using the latest beta at this point and the only Windows message-related functions I can see are GUICtrlSendMsg() and GUICtrlRecvMsg(). Link to comment Share on other sites More sharing options...
LxP Posted August 5, 2005 Author Share Posted August 5, 2005 Fantastic! Thanks to everyone for your help and to Larry for making me a man. From this it seems to my untrained eye that selecting system menu items could be doable from the WinMenuSelectItem() function, but I'm sated until then anyway. Link to comment Share on other sites More sharing options...
LxP Posted August 5, 2009 Author Share Posted August 5, 2009 (edited) Hello again, four-year-old thread! Got a PM requesting further info on my approach to solving this issue. Extreme kudos to the sender for searching the forums first, and requesting that I amend this thread for benefit of others.I was using some software called Winspector to monitor activity while I switched between full-screen and windowed modes in PuTTY. I discovered that selecting the appropriate system menu item resulted in a Windows message being emitted (WM_SYSCOMMAND to be precise, with a "wParam" of 0x180 for full screen toggling).Using PowerPro, I was able to confirm that sending a WM_SYSCOMMAND Windows message with this wParam value did indeed toggle full-screen and windowed modes. Getting AutoIt to do this was the puzzle. Larry responded between my above two posts (not sure why his post is no longer visible) and led me to this solution:#include <WinAPI.au3> #include <WindowsConstants.au3> Local Const $PUTTY_TOGGLE_FS = 0x180 _WinAPI_PostMessage($hWnd, $WM_SYSCOMMAND, $PUTTY_TOGGLE_FS, 0)Edit: Replaced hard-coded DLLCall for SendMessage with UDF call to the more appropriate PostMessage. Also named 0x180 for clearer relevance.where 0x180 above was specific to my problem. So in short I found the appropriate information getting emitted using Winspector, and then I formulated the appropriate DLLCall.I don't know if this is still necessary as I haven't been following AutoIt's development. Ideally, as mentioned above, WinMenuSelectItem would be built to offer manipulation of system menu items; perhaps it now is.I also don't know if all system menus function in this way; I possibly just got lucky with PuTTY. If your window doesn't emit or respond to a Windows message then I'm afraid I can't offer anything of further value. Edited August 6, 2009 by LxP Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 5, 2009 Share Posted August 5, 2009 (edited) Thanks for the update - turns out that I found the way to select an item off the System Menu myself, though the one I was looking to hit was 'Minimize'. I posted that method on the 'How to minimize all visible windows correctly' thread >_< . It's very much the same as yours, except I used PostMessage, and the 2nd parameter (wParam) was SC_MINIMIZE. I'm sorta confused, because I just looked up all the SC_ commands, and did not see 0x180 listed for anything (was thinking SC_RESTORE, SC_MAXIMIZE, etc - but all the SC_ commands start with 0xF in fact)!Do you have a clue if 0x180's functionality is listed anywhere? Or is specific to that program? hmm.. just tested it on some apps, didn't do a thing, so I'm assuming its the latter... well, thanks for updating the thread anyway.. now if people search, they'll find two answers Heck, might as well list them all.Here's info on the WM_SYSCOMMAND at MSDN, and here's a list of commands that can be sent (from Winuser.h):/* * System Menu Command Values */ #define SC_SIZE 0xF000 #define SC_MOVE 0xF010 #define SC_MINIMIZE 0xF020 #define SC_MAXIMIZE 0xF030 #define SC_NEXTWINDOW 0xF040 #define SC_PREVWINDOW 0xF050 #define SC_CLOSE 0xF060 #define SC_VSCROLL 0xF070 #define SC_HSCROLL 0xF080 #define SC_MOUSEMENU 0xF090 #define SC_KEYMENU 0xF100 #define SC_ARRANGE 0xF110 #define SC_RESTORE 0xF120 #define SC_TASKLIST 0xF130 #define SC_SCREENSAVE 0xF140 #define SC_HOTKEY 0xF150 #if(WINVER >= 0x0400) #define SC_DEFAULT 0xF160 #define SC_MONITORPOWER 0xF170 #define SC_CONTEXTHELP 0xF180 #define SC_SEPARATOR 0xF00F #endif /* WINVER >= 0x0400 */*edit: this is listed after those values, but I'm not sure what it does:#if(WINVER >= 0x0600) #define SCF_ISSECURE 0x00000001 #endif /* WINVER >= 0x0600 */ Edited August 5, 2009 by Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
LxP Posted August 6, 2009 Author Share Posted August 6, 2009 PostMessage is indeed a better way of doing things if you don't care about a result being returned from the call, which we don't for this.I just referred to the other thread that you mentioned because I was curious as to why you weren't using WinSetState with @SW_MINIMIZE to minimise the window. In doing so I learnt (and should mention to anyone else reading) that using _WinAPI_PostMessage from WinAPI.au3 is more appropriate. I'll update my code snippet above.0x180 is a code specific to PuTTY, meaning "toggle full-screen mode." It will likely have no relevance to anyone else's work. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now