Forum Discussion

howie_'s avatar
howie_
Contributor
10 years ago

Access to Winforms dialog titlebar buttons

Hi, 

 

I'm having difficulty programmatically identifying the red-x button at the top of a winforms dialog. I'm talking about the one in the top-right corner, normally seen next to the minimize and maximize buttons. Is anyone familiar with how to specify this button? I've been digging through the properties but I seem to be going around in circles.  

 

Any suggestions would be appreciated. 

 

Thanks, 

Howie 

  • Add the class name of the main form to the MSAA entry in Current Project Properties\Open Applications\MSAA

    Save and it may take a few seconds to refresh. 

  • brk9394's avatar
    brk9394
    Occasional Contributor

    In my Winforms apps, I cannot spy the 'X' button either. But I can spy the main Window, and then I can call the ".Close" method for that window.

    Brian

  • Add the class name of the main form to the MSAA entry in Current Project Properties\Open Applications\MSAA

    Save and it may take a few seconds to refresh. 

    • howie_'s avatar
      howie_
      Contributor

      This is exactly what I was looking for. It allows me to map the button and read it's properties as needed. Thank you. 

       

       

      For anyone else who's interested, I found more information about this method in article 74648: Project Properties - MSAA Options