开发者

Windows 7, how to tell another window to "snap" to maximum vertical size? And how to do that in elisp?

开发者 https://www.devze.com 2023-04-12 08:39 出处:网络
I recently discovered how on Windows in emacs elisp I can maximize an emacs frame: How do I set the size of Emacs' window?.

I recently discovered how on Windows in emacs elisp I can maximize an emacs frame: How do I set the size of Emacs' window?.

(defun w32-maximize-frame ()
  "Maximize the current frame"
  (interactive)
  (w32-send-sys-command 61488))

What I would prefer to do is have my emacs window "snap" to it's maximum vertical size using Windows 7 "snap" feature.

(defun w32-snap-max-vertical-frame ()
  "Maximize the vertical size of the current frame"
  (interactive)
  ; insert magic here
  )

Is there a similar windows message I can send to any window, or my emacs window to have it snap to maximum vertical size?

(As a start, I can google that 61488 above is 0xF300 and corresponds to WM_SYSCOMMAND SC_MAXIMIZE which is an entry in a window's system menu, and "snap to vertical" is not in that menu,开发者_C百科 so I don't think it would occur through a WM_SYSCOMMAND message....)


According to this blog post, you need to execute:

PostMessage(hwndTarget, WM_NCLBUTTONDBLCLK, HTTOP, 0);

I had a look, but it looks like emacs doesn't have a w32-send-mesage equivalent. If you do find one, WM_NCLBUTTONDBLCLK is 163, and HTTOP is 12.


Not sure what you're asking. You speak of both Emacs frames and Emacs windows, but I still somehow get the impression that perhaps you really mean that you want to maximize a frame but in the vertical directon only. Is that right?

If so, see command maximize-frame-vertically in frame-cmds.el. There are also commands maximize-frame-horizontally and maximize-frame, and commands to restore the frame to its sizes (vertical, horizontal, or both) before maximizing.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号