Hi Everyone,
could anyone help me on disabling the MIN,MAX,Close icon of EXE in free pascal.
Thanks,
sudarshan

Mailing lists / fpc-pascal / 2014-06
4 messages · 4 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi Everyone,
could anyone help me on disabling the MIN,MAX,Close icon of EXE in free pascal.
Thanks,
sudarshan
If you are writing for Windows, you just need to read the documentation on window style. WS_CAPTION, WS_MINIMIZEBOX and others, I must check the documentation every time I assign the style flags. See e.g. http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29.aspx
If you are writing for anything else, sorry about wasting everyone's time :)
Greetings,
Ingmar
2014-06-03 15:36 kirjutas mokashe.ram:
Based on previous communication, I'd assume that the original poster targets MS Windows, but he works on a console application resulting from porting of an old TP/BP DOS application rather than GUI. While I'm no Win32 developer, I suspect that the above mentioned API might not be relevant for console applications (probably implying that resolution of the requirement is possible only by changing the original applicationks code much more considerably).
Tomas
could anyone help me on disabling the MIN,MAX,Close icon of EXE in free pascal. sudarshan…
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 :