(MS Windows) Getting the HWND for a frame

(MS Windows) Getting the HWND for a frame

Post by Paul Moo » Fri, 04 Jul 2003 21:35:07



I want to get at the MS Windows "window handle" (HWND) for a XEmacs
frame. Is there a way of doing so? I've looked at the frame
properties, and nothing seems to fit (X Windows has a window-id
property, but it's not there on MS Windows...)

Thanks,
Paul.

 
 
 

1. Catching window system events (MS Windows)

I'm trying to set up XEmacs to make it hard for me to "accidentally"
shut down XEmacs. I have done much of what I want by adding an
exit-emacs hook, which asks me if I really mean to shut down, and
raises an error if I say "no".

But I'd like to go a little further. I can rebind C-x C-c to make that
key combination not exit Emacs. And I can rebind the menu entry and
M-f4 keystroke to make the menu do what I want.

But I can't see an obvious way of getting at the "system" close
methods - the close icon at the top right, and the system menu (top
left) "Close" item. These don't actually exit XEmacs - they close the
frame, and only exit XEmacs if the *last* frame is closed. I'd like to
close the frame, but if it's the last frame, minimise it - for now
just using (iconify-frame) but ideally to the system tray (but I need
to write a helper application to do that).

I can't see a way of hooking that "system close" functionality. I've
searched the "obvious" places - key bindings, menu bindings, hooks.
The only one even close is to use the exit-emacs-hook, but then (a) I
have to raise an error to stop the exit occurring, which is ugly, and
(b) it doesn't distinguish between the "system close" and any other
type (unless I can get this somehow from the current event, but I
don't know how...)

Has anyone got any suggestions?

Paul.

PS Actually, having a variable mswindows-close-to-systray or
something, which if true made XEmacs respond to the "close" icon on
the last frame by minimising to the system tray (like a number of
other programs have) would be nice, but it's very MS-specific...

2. jamming

3. Getting line number in frame

4. Printing Quiet vs Non-Quiet via CHTMLView chokes on XML - HELP!

5. Frames not getting deleted

6. xbox sound

7. Possibility to get informed (callback) when frame gets input focus?

8. Splintercell(most amazing game ever)

9. Getting the current frame, any ideas?

10. desktop.el broken after upgrade (ms-windows)

11. MS windows Xemacs: Meta (alt) shortcuts open menu

12. Cool Trick Part 3: Doing It On MS Windows : Switching Ctrl & Caps Lock Key Mappings

13. How to use cc-mode, psgml, etc. from MS Windows versions?