Opened 16 years ago

Closed 16 years ago

#116 closed Bug (Fixed)

Windows menu bug

Reported by: Champak Owned by: Jpm
Milestone: Component: AutoIt
Version: Severity:
Keywords: Win XP SP2 Cc:


This was brought up by PianoMan as a bug ( do to my post in the forum (, but it was not resolved do to, I suspect, how he explained it and his example.

WinMenuSelectItem does not work on hidden windows but the help file says that it does. PianoMan, made a workaround, which is cool, but isn't really any help because it requires both GUIs to initially show, which isn't practical.....for me at least.

Here is my example of what I am experiencing, and what I believe would be a more realistic/common encounter of the problem.

#include <GUIConstants.au3>

HotKeySet("{ENTER}", "HOTKEY")

$GUI1 = GUICreate("My GUI 1",300,200)
    GUICtrlCreateLabel("Now the msgbox wont show with the hotkey or button",20,120)
    $Button1 = GUICtrlCreateButton("Page 1", 40, 40)
    $ButtonMenu1 = GUICtrlCreateButton("Menu Test", 40, 70)
GUISetState (@SW_HIDE)

$GUI2 = GUICreate("My GUI 2",300,200)
    GUICtrlCreateLabel("MAIN PAGE",20,20)
    $filemenu = GUICtrlCreateMenu ("File")
    $fileitem = GUICtrlCreateMenuitem ("TEST",$filemenu)
    $Button2 = GUICtrlCreateButton("Page 2", 40, 40) 
	$ButtonMenu2 = GUICtrlCreateButton("Menu Test", 40, 70)
GUISetState ()

While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        Case $msg = $Button1
            GUISetState(@SW_HIDE, $GUI1)
            GUISetState(@SW_SHOW, $GUI2)

        Case $msg = $Button2
            GUISetState(@SW_HIDE, $GUI2)
            GUISetState(@SW_SHOW, $GUI1)
        Case $msg = $fileitem
            MsgBox(0,1,"Menu Clicked")
        Case $msg = $ButtonMenu1 Or $msg = $ButtonMenu2
            WinMenuSelectItem("My GUI 2", "MAIN PAGE", "File", "TEST")

    WinMenuSelectItem("My GUI 2", "MAIN PAGE", "File", "TEST");I've tried both the window handle and title

Attachments (0)

Change History (3)

comment:1 Changed 16 years ago by Valik

  • Milestone (Beta) deleted

comment:2 Changed 16 years ago by Jpm

  • Owner set to Jon
  • Status changed from new to assigned

comment:3 Changed 16 years ago by Jpm

  • Milestone set to
  • Owner changed from Jon to Jpm
  • Resolution set to Fixed
  • Status changed from assigned to closed

Fixed in version:

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The owner will remain Jpm.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.