delphi - Create FMX window with MessageBox style -


i have question: how can create fmx window make looks showmessage window?

showmessage (contain move , close items):

enter image description here

fmx window:

bordericons := [tbordericon.bisystemmenu]; borderstyle := tfmxformborderstyle.single; 

enter image description here

what need: remove icon , delete disabled menu items

on windows, showmessage() displays system dialog using win32 api messageboxindirect() function.

to customize default system menu of standard fmx form, have drop down win32 api layer , manipulate system menu directly. means getting hwnd of form (you can use formtohwnd() function in fmx.platform.win unit) , use win32 api getmenu() , deletemenu() functions.

to remove form's icon, use win32 api sendmessage() function send hwnd wm_seticon message lparam set 0. or use setwindowlongptr() enable ws_ex_dlgmodalframe window style.

override form's virtual createhandle() method perform these operations, eg:

interface  ...  type   tform1 = class(tform)     ...   {$ifdef mswindows}   protected     procedure createhandle; override;   {$endif}     ...   end;  implementation  {$ifdef mswindows} uses   windows; {$endif}  ...  {$ifdef mswindows} procedure tform1.createhandle; var   wnd: hwnd;        menu: hmenu;   exstyle: long_ptr; begin   inherited;   wnd := formtohwnd(self);    menu := getmenu(wnd);   deletemenu(menu, sc_tasklist, mf_bycommand);   deletemenu(menu, 7, mf_byposition);   deletemenu(menu, 5, mf_byposition);   deletemenu(menu, sc_maximize, mf_bycommand);   deletemenu(menu, sc_minimize, mf_bycommand);   deletemenu(menu, sc_size, mf_bycommand);   deletemenu(menu, sc_restore, mf_bycommand);    sendmessage(wnd, wm_seticon, icon_small, 0);   sendmessage(wnd, wm_seticon, icon_big, 0);    exstyle := getwindowlongptr(wnd, gwl_exstyle);   setwindowlong(wnd, gwl_exstyle, exstyle or ws_ex_dlgmodalframe);   setwindowpos(wnd, 0, 0, 0, 0, 0, swp_nomove or swp_nosize or swp_nozorder or swp_framechanged); end; {$endif}  ...  end. 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -