In the CREATE event of the window, code the following:

declare function GetSystemMenu, RemoveMenu
EQU MF_BYPOSITION$ TO 1024
hwnd = Get_Property( @window, 'HANDLE')
system_menu_hwnd = GetSystemMenu ( hwnd, 0)
rv = RemoveMenu (system_menu_hwnd, 6, MF_BYPOSITION$)
 

Using the handle of the window, the program gets the handle of the system menu (the menu with the Close menu item in it) by calling GetSystemMenu().  Then the Close menu item, the 6th item in the menu, is removed by calling RemoveMenu().

Adding DLL Declarations

The code above will not run until the declarations for GetSystemMenu() and RemoveMenu() have been added.  To add the declarations, do the following:

  1. Log out of the application.

  2. Log into the SYSPROG application.

  3. Add a row, (call it DLL_APICALLS_USER32), with the first line as USER32 and containing the declaration for RemoveMenu().  The declaration for GetSystemMenu() is not needed because it is declared in DLL_USER32, the DLL declarations shipped with OpenInsight  We will be adding declarations for other API functions in other examples.  The record contains at least the following lines:

    USER32
    ULONG STDCALL RemoveMenu ( HANDLE, ULONG, ULONG)
    //...other declarations in USER32 to follow...
  4. Save  the row.
  5. Run Declare_FCNS at the System Editor Exec Line to create the declaration header, as shown below:

    RUN DECLARE_FCNS 'DLL_APICALLS_USER32'
  6. Exit the editor.
  7. Log out of SYSPROG.
  8. Log into your application.
  9. Run the window.

The window should run, displaying as shown in the previous topic.

 

 

  • No labels