How to use SendMessage to sent ALT+F4 or Alt+f+x

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deepthi82
    New Member
    • Jul 2007
    • 7

    How to use SendMessage to sent ALT+F4 or Alt+f+x

    Hi All,

    I'm trying to close a browser window either by sending Alt+f4 or Alt+f to open the file menu and then 'x' to exit and am trying to achieve this using win32api.SendMe ssage(). I tried all combinations of WM_KEYDOWN, WM_SYSKEYDOWN, WM_CHAR, VK_MENU and VK_F4 but couldn't get this.
    I'm stuck on this one since two days and I really appreciate any help.
    I can't use sendkeys since this window is not always in focus. I can't also use
    SendMessage(hwn d, win32con.WM_SYS COMMAND, win32con.VK_CLO SE, 1) since there are some additional dialogs need to be handles upon close.
    (like the confirmation dialog for closing tabs)

    On a similar note can someone explain whats the last parameter used in SendMessage. I'm able to send 'tab' to a dialog using SendMessage(hwn d, win32con.WM_CHA R, win32con.VK_TAB , 1) but its not successful all the time if I replace 1 with 0 (the last param)

    Thanks in Advance!
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    The entire Win32 API is documented in the MSDN Liibrary. That particular page is here.

    Comment

    • deepthi82
      New Member
      • Jul 2007
      • 7

      #3
      Originally posted by bartonc
      The entire Win32 API is documented in the MSDN Liibrary. That particular page is here.
      I did go through the page before and I was successfully able to send keystrokes to he window which are not special. The only problem I couldn't have a solution for is sending the combination of two keys eg: Alt+F4.
      Please provide a sequence of steps which could do this.

      Comment

      • deepthi82
        New Member
        • Jul 2007
        • 7

        #4
        Can someone please help me with this? sending ALT+f to a window is what I need.

        Comment

        Working...