> Adrian noticed a glaring bug with that patch: the command will
> segfault if you give it a non Win32-GUI frame. Unfortunately, I
> couldn't figure out how to test whether a frame is a Win32-GUI frame
> at the time and I no longer have a Windows machine to hack on.
(device-type (frame-device (selected-frame))) returns mswindows
Thanks Jeff!
Hm. CHECK_MSWINDOWS_FRAME looks promising. René, does the patch
below work?
If it doesn't, is the following equivalent to Jeff's test ?
(EQ (DEVICE_CONSOLE (FRAME_DEVICE (decode_frame (frame))),
Qmswindows))
--- frame-msw.c 25 Nov 2005 01:42:02 +0000 1.59
+++ frame-msw.c 04 May 2006 21:01:33 +0100
@@ -836,6 +836,33 @@
return IsZoomed (FRAME_MSWINDOWS_HANDLE (f));
}
+
+
+DEFUN ("mswindows-send-sys-command", Fmswindows_send_sys_command, 1, 2, 0, /*
+Send FRAME a Windows WM_SYSCOMMAND message of type COMMAND.
+Some useful values for COMMAND are #xf030 to maximize frame and #xf020
+to minimize it, #xf120 to restore frame to original size, and #xf100
+to activate the menubar for keyboard access. #xf140 activates the
+screen saver if defined. #xf130 activates the Start Menu.
+
+If FRAME is not specified, the selected frame will be used.
+*/
+ (command, frame))
+{
+ if (NILP (frame))
+ frame = Fselected_frame (Qnil);
+ CHECK_LIVE_FRAME (frame);
+ CHECK_MSWINDOWS_FRAME (frame);
+ CHECK_INT (command);
+
+ qxePostMessage (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), WM_SYSCOMMAND,
+ XINT (command), 0);
+
+ return Qnil;
+}
+
+
+
/*---------------------------------------------------------------------*/
/*----- PRINTER FRAME -----*/
/*---------------------------------------------------------------------*/
@@ -1205,6 +1232,7 @@
#ifdef NEW_GC
INIT_LRECORD_IMPLEMENTATION (mswindows_frame);
#endif /* NEW_GC */
+ DEFSUBR (Fmswindows_send_sys_command);
}
void