Arsip: tanya disabled tombol close

 
user image
more 18 years ago

ingusan

mo nanya mas2 sekalian... gimana cara men-disabled kan tombol close pada form pada saat program di running ?? thanks be4
user image
more 18 years ago

erwinkiting

kalau untuk menghilangkan tombol closenya saya tau Properties->BorderIcons->biSystemMenu->False tapi dengan cara diatas tombol Minimize dan Maximize juga hilang
user image
more 18 years ago

wekswek

procedure TForm1.FormCloseQuery(Sender:TObject; var CanClose: Boolean); begin if titik...titik... then CanClose := false; end;
user image
more 18 years ago

chipmunk

..disable tombol close tidak mencegah closing misal dg ALT-F4, tp bisa ditrap pada OnCloseQuery()... utk men-disabled aja (system menu jg akan sinkron) coba code ini di OnCreate()
procedure TForm1.FormCreate(Sender: TObject);
var
  mi : TMenuItemInfo;
  hm: HMENU;
begin
  hm := GetSystemMenu(Handle, false);
  mi.cbSize := sizeof(TMenuiteminfo);
  mi.fMask := MIIM_STATE;
  GetMenuItemInfo(hm,SC_CLOSE,false,mi);
  mi.fState := MFS_DISABLED;
  SetMenuItemInfo(hm,SC_CLOSE,false,mi);
end;
btw, buat apa sih? :) - chipmunk -
user image
more 18 years ago

DelphiExpert

Betul bro Chipmunk bilang... disabled tombol close, app tetap bisa ditutup pake ALT+F4 Ato pake code berikut:

var
  Flag: UINT;
  AppSysMenu: THandle;
begin
  AppSysMenu:=GetSystemMenu(Handle,False);
  Flag:=MF_GRAYED;
  EnableMenuItem(AppSysMenu,SC_CLOSE,MF_BYCOMMAND or Flag);
end;
untuk meng-enabled-kan pake parameter MF_ENABLED (Flag)
user image
more 18 years ago

tox2wow

Nambahin dikit ... :D ... untuk disabled-nya udah bisa seperti yg dibilangin bung chipmunk sama bung DelphiExpert. Kalo yg gw kaya gini :
Procedure DisabledTombolClose;
var
  MenuHandle: Integer;
begin
  MenuHandle := GetSystemMenu(Handle, False);
  if (MenuHandle <> 0) then
    ModifyMenu(MenuHandle, SC_CLOSE, MF_BYCOMMAND or
               MF_GRAYED or MF_DISABLED, SC_CLOSE, 'Close');
And untuk disabled ALT+F4 nya, kaya yg dibilangin wkeswek :
procedure TForm1.FormCloseQuery(Sender:TObject; var CanClose:Boolean);
begin
 CanClose := False;
end;
Keep trying bro .. :P
user image
more 18 years ago

ingusan

@chipmunk: ..disable tombol close tidak mencegah closing misal dg ALT-F4, tp bisa ditrap pada OnCloseQuery()... utk men-disabled aja (system menu jg akan sinkron) coba code ini di OnCreate()
procedure TForm1.FormCreate(Sender: TObject);
var
  mi : TMenuItemInfo;
  hm: HMENU;
begin
  hm := GetSystemMenu(Handle, false);
  mi.cbSize := sizeof(TMenuiteminfo);
  mi.fMask := MIIM_STATE;
  GetMenuItemInfo(hm,SC_CLOSE,false,mi);
  mi.fState := MFS_DISABLED;
  SetMenuItemInfo(hm,SC_CLOSE,false,mi);
end;
- chipmunk -
terimakasih kepada mas2 semua atas pencerahannya ... :D >>>btw, buat apa sih? :) ini untuk miniatur alat yang ane bikin(PKL) mas... jadi user ga bisa menghentikan program selama alat ini di running... ..... sekali lagi thanks.... VIVA Delphi indonesia.. :D
more ...
  • Pages:
  • 1
Share to

AI Forward

🚀 We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now: https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com