Изменение внешнего вида окон в среде Microsoft Visual C++, страница 2

      dwStl = dwStl|WS_MINIMIZEBOX;

      SetWindowLong(hWnd,GWL_STYLE,dwStl);

      ::UpdateWindow(hWnd);

}

void CMainFrame::OnHideMinimizeButton()

{

      HWND hWnd = ::FindWindow(NULL, TEXT("Untitled - lab2"));

      DWORD dwStl = GetWindowLong(hWnd, GWL_STYLE);

      if (dwStl&WS_MINIMIZEBOX) dwStl = dwStl^WS_MINIMIZEBOX;

      SetWindowLong(hWnd,GWL_STYLE,dwStl);

      ::UpdateWindow(hWnd);

}

void CMainFrame::OnShowMaximizeButton()

{

      HWND hWnd = ::FindWindow(NULL, TEXT("Untitled - lab2"));

      DWORD dwStl = GetWindowLong(hWnd, GWL_STYLE);

      dwStl = dwStl|WS_MAXIMIZEBOX;

      SetWindowLong(hWnd,GWL_STYLE,dwStl);

      ::UpdateWindow(hWnd);

}

void CMainFrame::OnHideMaximizeButton()

{

      HWND hWnd = ::FindWindow(NULL, TEXT("Untitled - lab2"));

      DWORD dwStl = GetWindowLong(hWnd, GWL_STYLE);

      if (dwStl&WS_MAXIMIZEBOX) dwStl = dwStl^WS_MAXIMIZEBOX;

      SetWindowLong(hWnd,GWL_STYLE,dwStl);

      ::UpdateWindow(hWnd);

}

void CMainFrame::OnShowSystemMenuButton()

{

      HWND hWnd = ::FindWindow(NULL, TEXT("Untitled - lab2"));

      DWORD dwStl = GetWindowLong(hWnd, GWL_STYLE);

      dwStl = dwStl|WS_SYSMENU;

      SetWindowLong(hWnd,GWL_STYLE,dwStl);

      ::UpdateWindow(hWnd);

}

void CMainFrame::OnHideSystemMenuButton()

{

      HWND hWnd = ::FindWindow(NULL, TEXT("Untitled - lab2"));

      DWORD dwStl = GetWindowLong(hWnd, GWL_STYLE);

      if (dwStl&WS_SYSMENU) dwStl = dwStl^WS_SYSMENU;

      SetWindowLong(hWnd,GWL_STYLE,dwStl);

      ::UpdateWindow(hWnd);

}

            Соответствующие модификации карты сообщений для указания назначения вышеперечисленных функций как обработчиков сообщений в модуле lab2.cpp

ON_COMMAND(ID_MINIMIZEBUTTON_SHOW, &CMainFrame::OnShowMinimizeButton)

ON_COMMAND(ID_MINIMIZEBUTTON_HIDE, &CMainFrame::OnHideMinimizeButton)

ON_COMMAND(ID_MAXIMIZEBUTTON_SHOW, &CMainFrame::OnShowMaximizeButton)