[fpc-pascal] Disabling the MIN, MAX, Close icon of EXE in free pascal

Yann Mérignac yann.merignac at gmail.com
Wed Jun 4 15:45:01 CEST 2014


This program works (at least on windows XP) but must be changed according
to your language :

program consprg;

{$mode objfpc}{$H+}

uses
  Classes, Crt, windows;

const
  CloseItemString = '&Fermer';  // '&Fermer' : french
                                             // probably '&Close' in english

function GetConsoleWindow : HWND; external 'kernel32' name
'GetConsoleWindow';

var
  H: HWND;
  SM: HMENU;
  C, I, J: LongInt;
  Buf : array [0..255] of Char;
  Close : Boolean;
begin
  H := GetConsoleWindow;
  SM := GetSystemMenu(H, false);
  C := GetMenuItemCount(SM);

  J := -1;
  for I := 0 to C - 1 do
  begin
    GetMenuString(SM, I, Buf, 255, MF_BYPOSITION);
    if Buf = CloseItemString then
    begin
      J := I;
      Break;
    end;
  end;

  if J > 0 then
    RemoveMenu(SM, J, MF_BYPOSITION);

  ClrScr;
  WriteLn('press ESC to quit');
  GotoXY(10, 10);
  WriteLn('Hello');

  Close := false;
  while not Close do
  begin
    Delay(10);
    if KeyPressed then
      Close := (ReadKey = #27);
  end;
end.



2014-06-03 14:36 GMT+02:00 mokashe.ram <mokashe.ram at gmail.com>:

> Hi Everyone,
>
>  could anyone help me on disabling the MIN,MAX,Close icon of EXE in free
> pascal.
>
> Thanks,
> sudarshan
>
>
>
> --
> View this message in context:
> http://free-pascal-general.1045716.n5.nabble.com/Disabling-the-MIN-MAX-Close-icon-of-EXE-in-free-pascal-tp5719494.html
> Sent from the Free Pascal - General mailing list archive at Nabble.com.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140604/c1a5e76b/attachment.html>


More information about the fpc-pascal mailing list