Jump to content

Recommended Posts

Posted

Orginally this code was in its own exe, so when the exe closed then all the memory / varaibles and such get realeased. But now it is merged into code that runs 24/7.

The idea behind this code is to display two menus "Menu 1 and 2", wait 2.5 seconds, delete the menus and then re-make them with new menu names

#NoTrayIcon
#include 
Local $ContextMenu
Local $MainContextMenu

$ContextMenu = GUICreate('',0, 0, 0, 0, -2147483648, 128)
$MainContextMenu = GUICtrlCreateContextMenu()
_GUICtrlMenu_SetMenuStyle(GUICtrlGetHandle($MainContextMenu), BitXOR(_GUICtrlMenu_GetMenuStyle(GUICtrlGetHandle($MainContextMenu)), $MNS_MODELESS))
GUICtrlCreateMenuItem("Menu 1", $MainContextMenu)
GUICtrlCreateMenuItem("Menu 2", $MainContextMenu)
ControlClick("", "", $ContextMenu, "Right", 1, 0, 0)

sleep(2500) ; Delay

GUIDelete($ContextMenu)
GUICtrlDelete($MainContextMenu)

sleep(2500) ; Delay

$ContextMenu = GUICreate('',0, 0, 0, 0, -2147483648, 128)
$MainContextMenu = GUICtrlCreateContextMenu()
_GUICtrlMenu_SetMenuStyle(GUICtrlGetHandle($MainContextMenu), BitXOR(_GUICtrlMenu_GetMenuStyle(GUICtrlGetHandle($MainContextMenu)), $MNS_MODELESS))
GUICtrlCreateMenuItem("Menu 3", $MainContextMenu)
GUICtrlCreateMenuItem("Menu 4", $MainContextMenu)
ControlClick("", "", $ContextMenu, "Right", 1, 0, 0)

sleep(2500) ;Delay

The first Menu is made, and it does delete but the second never appears. So am i doing something wrong ?

Posted (edited)

Not really an option. The full code is alot more complex, but basicly when the context menu is run depending on how the user interacts with it. It will add alot more menus 2 do it. So when the menu is finished, if these are not cleared away then the next time the menu is opened, it would still have all the lasted opened menus showing rather then just showing the default ones

*Edit, Ok it is a option ^^ but one i would rather avoid. As it means the longer the code is run, and the more items are being stored in unused varaibles have no purpose as they should be deleted once the menu is finished.

Edited by IanN1990

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