|
꾸벅^^.... 장성호 고수님 답변 감사합니다....
장성호 님이 쓰신 글 :
: 그냥 프로그램이 Minimize나 Hide된 상태에서
: Nomal 이나 Maximize 상태로 복귀 시키는 것입니다.
:
: 아래는 VCL 원본 코드와 그걸 C++Builder로 변환해 봤습니다.
: // VCL Delphi 코드
: procedure TApplication.Restore;
: begin
: if IsIconic(FHandle) then
: begin
: SetActiveWindow(FHandle);
: if (MainForm <> nil) and (ShowMainForm or MainForm.Visible)
: and IsWindowEnabled(MainForm.Handle) then
: DefWindowProc(FHandle, WM_SYSCOMMAND, SC_RESTORE, 0)
: else ShowWinNoAnimate(FHandle, SW_RESTORE);
: SetWindowPos(FHandle, 0, GetSystemMetrics(SM_CXSCREEN) div 2,
: GetSystemMetrics(SM_CYSCREEN) div 2, 0, 0, SWP_SHOWWINDOW);
: if (FMainForm <> nil) and (FMainForm.FWindowState = wsMinimized) and
: not FMainForm.Visible then
: begin
: FMainForm.WindowState := wsNormal;
: FMainForm.Show;
: end;
: RestoreTopMosts;
: if Screen.ActiveControl <> nil then
: Windows.SetFocus(Screen.ActiveControl.Handle);
: if Assigned(FOnRestore) then FOnRestore(Self);
: end;
: end;
: //---------------------------------------------------------------------------
:
: // C++Builder
: void TApplication::Restore()
: {
: if( IsIconic(FHandle) )
: {
: SetActiveWindow(FHandle);
: if( (MainForm !=NULL) && (ShowMainForm || MainForm->Visible) && IsWindowEnabled(MainForm->Handle) )
: DefWindowProc(FHandle, WM_SYSCOMMAND, SC_RESTORE, 0)
: else
: ShowWinNoAnimate(FHandle, SW_RESTORE);
:
: SetWindowPos(FHandle, 0, GetSystemMetrics(SM_CXSCREEN) / 2, GetSystemMetrics(SM_CYSCREEN) / 2, 0, 0, SWP_SHOWWINDOW);
:
: if( (FMainForm != NULL) && (FMainForm->FWindowState == wsMinimized) && ! FMainForm->Visible )
: {
: FMainForm->WindowState = wsNormal;
: FMainForm->Show();
: }
: RestoreTopMosts();
: if( Screen->ActiveControl != NULL )
: {
: SetFocus(Screen->ActiveControl->Handle);
: }
: if( Assigned(FOnRestore) )
: FOnRestore(this);
: }
: }
: //---------------------------------------------------------------------------
:
:
: 박영목 님이 쓰신 글 :
: : Application->Restore(); 이것을 API로 표현하면 어떻게 될까요?
: :
: : 아주 궁금함,...... 아시는 분 답변...... 부탁드립니다........
|