먼저 함수 선언은..
private
{ Private declarations }
procedure WMSysCommand(var msg: TWMSysCommand); message WM_SysCommand;
//Form1.h 파일에서 ..
{
private
void __fastcall WMSysCommand(TWMSysCommand &msg); //WM_SysCommand;
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_SYSCOMMAND, TWMSysCommand , WMSysCommand)
END_MESSAGE_MAP(TForm)
}
그리고 수신하는 부분은..
procedure TForm1.WMSysCommand(var msg: TWMSysCommand);
begin
if msg.CmdType and $FFF0 = SC_MINIMIZE then
hide
else
inherited;
end;
procedure TForm1.FormShow(Sender: TObject);
var
hwndOwner: HWnd;
begin
hwndOwner := GetWindow(Handle, GW_OWNER);
ShowWindow(hwndOwner, SW_HIDE);
// For Windows 2000, additionally call the ShowWindowAsync function:
ShowWindowAsync(hwndOwner, SW_HIDE);
ShowWindowAsync(Self.Handle, SW_HIDE);
end;
//다음과 같이...
void __fastcall TForm1::WMSysCommand(TWMSysCommand &msg)
{
if( msg.CmdType && $FFF0 == SC_MINIMIZE )
{
this->Hide();
}
else
TCustomForm::Dispatch(&msg);
}
void __fastcall TForm1::FormShow(TObject *Sender);
{
HWND hwndOwner;
hwndOwner = GetWindow(Handle, GW_OWNER);
ShowWindow(hwndOwner, SW_HIDE);
// For Windows 2000, additionally call the ShowWindowAsync function:
ShowWindowAsync(hwndOwner, SW_HIDE);
ShowWindowAsync(Handle, SW_HIDE);
}
대충 위와같을듯 하네요...
그럼..
제이원 님이 쓰신 글 :
: private
: { Private declarations }
: procedure WMSysCommand(var msg: TWMSysCommand); message WM_SysCommand;
:
:
: procedure TForm1.WMSysCommand(var msg: TWMSysCommand);
: begin
: if msg.CmdType and $FFF0 = SC_MINIMIZE then
: hide
: else
: inherited;
: end;
:
:
: procedure TForm1.FormShow(Sender: TObject);
: var
: hwndOwner: HWnd;
: begin
: hwndOwner := GetWindow(Handle, GW_OWNER);
: ShowWindow(hwndOwner, SW_HIDE);
: // For Windows 2000, additionally call the ShowWindowAsync function:
: ShowWindowAsync(hwndOwner, SW_HIDE);
: ShowWindowAsync(Self.Handle, SW_HIDE);
: end;