2006-05-18  John Paul Wallington  <jpw(a)pobox.com>
	    René Kyllingstad  <listmailxemacs(a)kyllingstad.com>	
	* frame-msw.c (Fmswindows_send_sys_command): New builtin.
	(syms_of_frame_mswindows): Defsubr it.
--- frame-msw.c	25 Nov 2005 01:42:02 +0000	1.59
+++ frame-msw.c	18 May 2006 20:52:46 +0100	
@@ -836,6 +836,32 @@
   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.
+If FRAME is not a Win32 GUI frame then do nothing.
+*/
+       (command, frame))
+{
+  CHECK_INT (command);
+  CHECK_LIVE_FRAME (frame);
+
+  if (NILP (frame))
+    frame = Fselected_frame (Qnil);
+
+  if (FRAME_TYPE_P (XFRAME (frame), mswindows))
+    qxePostMessage (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), WM_SYSCOMMAND,
+		      XINT (command), 0);
+
+  return Qnil;
+}
+
+
 /*---------------------------------------------------------------------*/
 /*-----                    PRINTER FRAME                          -----*/
 /*---------------------------------------------------------------------*/
@@ -1205,6 +1231,7 @@
 #ifdef NEW_GC
   INIT_LRECORD_IMPLEMENTATION (mswindows_frame);
 #endif /* NEW_GC */
+  DEFSUBR (Fmswindows_send_sys_command);
 }
 
 void