Sign in to follow this  
Followers 0
rejectpenguin

Task Menu

6 posts in this topic

Is there an autoit command to pop up a tasks menu.. By task menu i mean when u right click on a program it shows the menu with close, move, minimize.. etc..

Thanks in advance!

Share this post


Link to post
Share on other sites



Is there an autoit command to pop up a tasks menu.. By task menu i mean when u right click on a program it shows the menu with close, move, minimize.. etc..

Thanks in advance!

GUICreate("Your Window", 100, 100, 0, 0, BitOR(-1, $WS_CAPTION, $WS_SYSMENU))

According to the help file adding the styles $WS_SYSMENU and $WS_CAPTION to your GUICreate function should do it but i cant get it to work :)


Click here for the best AutoIt help possible.Currently Working on: Autoit RAT

Share this post


Link to post
Share on other sites

Do you mean you want a menu for your own custom GUI or the menu of another program's window?

I want another programs window.. Like notepad for instance.

Share this post


Link to post
Share on other sites

For your own Application, you can do this:

CODE
#include <WindowsConstants.au3>

#include <GUIMenu.au3>

;~ Global Const $SC_CLOSE = 0xF060

;~ Global Const $SC_CONTEXTHELP = 0xF180

;~ Global Const $SC_DEFAULT = 0xF160

;~ Global Const $SC_HOTKEY = 0xF150

;~ Global Const $SC_HSCROLL = 0xF080

;~ Global Const $SC_KEYMENU = 0xF100

;~ Global Const $SC_MAXIMIZE = 0xF030

;~ Global Const $SC_MINIMIZE = 0xF020

;~ Global Const $SC_MONITORPOWER = 0xF170

;~ Global Const $SC_MOUSEMENU = 0xF090

;~ Global Const $SC_MOVE = 0xF010

;~ Global Const $SC_NEXTWINDOW = 0xF040

;~ Global Const $SC_PREVWINDOW = 0xF050

;~ Global Const $SC_RESTORE = 0xF120

;~ Global Const $SC_SCREENSAVE = 0xF140

;~ Global Const $SC_SIZE = 0xF000

;~ Global Const $SC_TASKLIST = 0xF130

;~ Global Const $SC_VSCROLL = 0xF070

$myGUI = GUICreate("TheGUI")

GUISetState()

; The User IDs for the commands

Global Enum $SMC_TASKMAN = 2001, $SMC_MSGBOX

$SystemMenu = _GUICtrlMenu_GetSystemMenu($myGUI)

_GUICtrlMenu_AddMenuItem($SystemMenu,"Show &Message Box",$SMC_MSGBOX) ; Add a user command

_GUICtrlMenu_InsertMenuItem($SystemMenu,5,"&Task Manager",$SMC_TASKMAN); Insert a user command

_GUICtrlMenu_InsertMenuItem($SystemMenu,5,"Show &Start Menu",$SC_TASKLIST); Insert a system command

_GUICtrlMenu_InsertMenuItem($SystemMenu,5,"") ; insert a separator

$SysMenuDummy = GUICtrlCreateDummy() ; Translates Command to action

GUIRegisterMsg($WM_SYSCOMMAND,"_MENU_WM_SYSCOMMAND") ; receives Command

While 1

$msg = GUIGetMsg()

Switch $msg

Case -3

Exit

Case $SysMenuDummy

SysMenu_Events(Number(GUICtrlRead($SysMenuDummy)))

EndSwitch

WEnd

Func SysMenu_Events($BTN_ID)

Switch $BTN_ID

Case $SMC_MSGBOX

MsgBox(0, '', "You clicked new Command")

Case $SMC_TASKMAN

Run("taskmgr")

;~ Send("{LCTRL down}{LALT down}{DEL}{LCTRL up}{LALT up}")

EndSwitch

EndFunc

Func _MENU_WM_SYSCOMMAND($hWndGUI, $MsgID, $wParam, $lParam)

$wParam = Number($wParam)

If $wParam >= 0xF000 And $wParam < 0xF200 Then Return 'GUI_RUNDEFMSG' ; This are the normal commands

GUICtrlSendToDummy($SysMenuDummy, $wParam) ; The others are set to Dummy

Return 'GUI_RUNDEFMSG'

EndFunc ;==>_TB_WM_NOTIFY

You can insert the Items in other apps, too, but you can't get the Clicked-Event.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Nice example ProgAndy! :P

You can insert the Items in other apps, too, but you can't get the Clicked-Event.

Too bad :( is there really no way to add some sort of "Events Listener" for external applications?

P.S

And how do we get a text from the inserted items? i tried with the used ids when the items are inserted (1000, 1001 etc.), but all known (to me) functions fails to get text...


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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  
Followers 0