Kbase P16350: How to disable the MOVE option of a window after it is reali
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/2/2003 |
|
Status: Unverified
GOAL:
How to disable the MOVE option of a window after it is realized?
FACT(s) (Environment):
Windows 32 Intel
FACT(s) (Environment):
Windows NT 32 Intel/Windows 2000
FACT(s) (Environment):
Windows
FIX:
The following solution disables the MOVE and the SIZE options of a window. The code can easily be modified to disable the RESTORE, MINIMIZE, MAXIMIZE, and CLOSE options.
1. In the main block of the window insert the procedure call:
RUN SupressWindowMove.
after the:
RUN enable_UI.
statement in the case of a regular window, or after the
{src/adm2/windowmn.i}
statement in the case of a smart window.
2. Define the internal procedure SupressWindowMove as follows:
/*------------------------------------------------------------------------------
Purpose: Disable the SIZE and MOVE options of the window object.
Parameters: <none>
------------------------------------------------------------------------------*/
/* menu item identifiers */
&SCOPED-DEFINE SC_RESTORE 61728
&SCOPED-DEFINE SC_MOVE 61456
&SCOPED-DEFINE SC_SIZE 61440
&SCOPED-DEFINE SC_MINIMIZE 61472
&SCOPED-DEFINE SC_MAXIMIZE 61488
&SCOPED-DEFINE SC_CLOSE 61536
/* menu action mode flags */
&SCOPED-DEFINE MF_BYCOMMAND 0
&SCOPED-DEFINE MF_BYPOSITION 1024
/* menu item identifier */
&SCOPED-DEFINE MF_INSERT 0
&SCOPED-DEFINE MF_CHANGE 128
&SCOPED-DEFINE MF_APPEND 256
&SCOPED-DEFINE MF_DELETE 512
&SCOPED-DEFINE MF_REMOVE 4096
DEFINE VARIABLE iHWND AS INTEGER INITIAL 0 NO-UNDO.
DEFINE VARIABLE iMenu AS INTEGER INITIAL 0 NO-UNDO.
DEFINE VARIABLE iResult AS INTEGER INITIAL 0 NO-UNDO.
RUN GetParent(
INPUT {&WINDOW-NAME}:HWND,
OUTPUT iHWND).
RUN GetSystemMenu (
INPUT iHWND,
INPUT 0,
OUTPUT iMenu).
RUN RemoveMenu(
INPUT iMenu,
INPUT {&SC_MOVE},
INPUT {&MF_BYCOMMAND} + {&MF_DELETE},
OUTPUT iResult).
/* After deleting the MOVE option, SIZE option position becomes 1 */
RUN RemoveMenu(
INPUT iMenu,
INPUT 1,
INPUT {&MF_BYPOSITION} + {&MF_REMOVE},
OUTPUT iResult).
RUN DrawMenuBar(
INPUT iHWND,
OUTPUT iResult).
END PROCEDURE.
PROCEDURE GetParent EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER iHWND AS LONG NO-UNDO.
DEFINE RETURN PARAMETER iResult AS LONG NO-UNDO.
END PROCEDURE.
PROCEDURE GetSystemMenu EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER iHWND AS LONG NO-UNDO.
DEFINE INPUT PARAMETER iBRevert AS LONG NO-UNDO.
DEFINE RETURN PARAMETER iHMenu AS LONG NO-UNDO.
END PROCEDURE.
PROCEDURE RemoveMenu EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER ihMenu AS LONG NO-UNDO.
DEFINE INPUT PARAMETER iuPosition AS LONG NO-UNDO.
DEFINE INPUT PARAMETER iuFlags AS LONG NO-UNDO.
DEFINE RETURN PARAMETER iResult AS LONG NO-UNDO.
END PROCEDURE.
PROCEDURE DrawMenuBar EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER ihMenu AS LONG NO-UNDO.
DEFINE RETURN PARAMETER iResult AS LONG NO-UNDO.
END PROCEDURE.
/*----------------------------------------------------------------------------*/