PostMessage problem with large test script.

Issue #51 closed
Winter Laite created an issue

Please run KS_Tests41.ahk to duplicate the problem. I’ve been unable to duplicate it with smaller scripts.

Problem: See lines 349 to 361 in the script. Clicking “Show Notepad ‘About’” button works without issue, and can be rerun as many times as desired. However, after it’s clicked just once no other buttons in the script will function anymore.

(This code runs fine, and doesn’t duplicate the problem, but uses nearly verbatim code from lines 349 to 361.)

MyGui := Gui(, "Test PostMessage")
Tab := MyGui.Add("Tab3", "w300 h220" , ["First","Second"])
Tab.UseTab("First")
gb1 := MyGui.Add("GroupBox", "x10 y10 w250 h175", "Group test") ; 
MyGui.UseGroup(gb1) 
MyGui.Add("Text", , "Testing PostMessage problem")
Btn1 := MyGui.Add("Button", "x10 y+10", "Do stuff")
Btn1.OnEvent("Click", "DoStuff")
PostBtn1 := MyGui.Add("Button", "x10 y+10", "Show Notepad 'About'")
PostBtn1.OnEvent("Click", "AboutNotepad")
MyGui.Show()

DoStuff() {
    MsgBox("Stuff done", "PostMessage", "T2")
}

AboutNotepad() {
    SetTitleMatchMode(2)
    Run("Notepad.exe")
    Sleep(1000)
    PostMessage(0x0111, 65, 0, , "Untitled - Notepad")
    Sleep(2000)
    WinKill("ahk_exe Notepad.exe")
}

Comments (2)

  1. Log in to comment