=================================
=================================
=================================
출처: https://www.npteam.net/63
//OnInitDialog() 부분에 추가하면 된다.
LONG style = ::GetWindowLong( m_hWnd, GWL_STYLE );
style &= ~WS_CAPTION;
style &= ~WS_SYSMENU;
::SetWindowLong( m_hWnd, GWL_STYLE, style );
int screenx = GetSystemMetrics( SM_CXSCREEN );
int screeny = GetSystemMetrics( SM_CYSCREEN );
// resize:
SetWindowPos( NULL, -4, -4, screenx+8, screeny+4, SWP_NOZORDER );
=================================
=================================
=================================
출처: https://blogs.msdn.microsoft.com/pusu/2009/10/28/how-to-add-full-screen-mode-in-your-mfc-app-visual-studio-2008-or-later/
Recently I need to add full screen mode for one of my MFC projects. Like what we did usually, my first impression is to hide the tool bar of main frame and expand the size of view. Thus, I need to calculate the system screen size (GetSystemMetrics() API), to calculate the current size of windows frame (GetWindowRect() API), and to reset the location/coordinator of main frame( SetWindowPos() API).
It is not hard, but it really took me much time on implementating it. Then, I tested it and found the full screen mode can be displayed. However, when I tried to go back to normal size, my Ribbonbar dissappeared! Thus, I realized that I need to do more work about Ribbon bar. When I read the documentation on MSDN, fortunately I found a very interesting class "CFullScreenImpl" class in MFC. http://msdn.microsoft.com/en-us/library/cc308980.aspx
Thus, I tried it in my Visual Studio 2010. Easy!!! You only need to do three things:
- Create a button or check box or any control (you want users to click) to get full screen mode. Remmember its ID, for example, ID_VIEW_FULLSCREEN
- In MainFrm.cpp, at the end of OnCreate() API, write two lines
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
............
// enable full screen mode
EnableFullScreenMode (ID_VIEW_FULLSCREEN); // the ID of your control you created in step 1
EnableFullScreenMainMenu(FALSE);
return 0;
}
3. In MainFrm.cpp, add an event handler function for your control in step (1), and add ShowFullScreeen().
void CMainFrame::OnViewFullscreen()
{
ShowFullScreen();
}
That is it! Very simple! I hope more and more people can enjoy it!
=================================
=================================
=================================
출처: https://social.msdn.microsoft.com/Forums/vstudio/ko-KR/8e50a09f-65ae-424d-9580-34a58286ba95/mfc-maximizefull-screen?forum=vcgeneral
Alright i figured it out. i have a button to toggle full screen mode. When i press it the first time i do this
ModifyStyle( WS_MAXIMIZEBOX,0); ModifyStyle( WS_MINIMIZEBOX,0); ModifyStyle( WS_CAPTION,0); ShowWindow(SW_SHOWMAXIMIZED);
And that will make the application full screen. ModifyStyle( 0,WS_MAXIMIZEBOX); ModifyStyle(0, WS_MINIMIZEBOX); ModifyStyle( 0,WS_CAPTION); ShowWindow(SW_NORMAL);
And it will go back to the normal window. Thanks for your help!MoveWindow(hWnd, GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN), GetSystemMetrics(SM_CXVIRTUALSCREEN), GetSystemMetrics(SM_CYVIRTUALSCREEN), TRUE);
Nikita Leontiev
=================================
=================================
=================================
출처: http://sijoo.tistory.com/137
/////// 전역변수 /////// int _style; CRect _originWindow; //------------------------------------ void CEx2Dlg::OnBnClickedButton1() // 전체화면 { int windowWidth = GetSystemMetrics(SM_CXSCREEN); int windowHeight = GetSystemMetrics(SM_CYSCREEN); _style = ::GetWindowLong( this ->m_hWnd, GWL_STYLE); ::GetWindowRect( this ->m_hWnd, &_originWindow); ::SetWindowLong( this ->m_hWnd, GWL_STYLE, NULL); SetWindowPos(&wndTopMost, 0, 0, windowWidth, windowHeight, NULL); ShowWindow( SW_MAXIMIZE ); } void CEx2Dlg::OnBnClickedButton2() // 원래대로 { ::SetWindowLong( this ->m_hWnd, GWL_STYLE, _style); SetWindowPos(GetParent(), _originWindow.left, _originWindow.top, _originWindow.right - _originWindow.left, _originWindow.bottom - _originWindow.top, NULL); } |
출처: http://sijoo.tistory.com/137 [Jooo's life story]
=================================
=================================
=================================
출처: http://purelab.net/zbxe/guruin/1196
최소화
SendMessage( WM_SYSCOMMAND, SC_MINIMIZE );
=================================
=================================
=================================
출처: http://hypen1117.tistory.com/entry/%EC%9C%88%EB%8F%84%EC%9A%B0-%EC%B5%9C%EC%86%8C%ED%99%94-%EC%8B%9C%ED%82%A4%EB%8A%94-%ED%95%A8%EC%88%98%EB%93%A4
윈도우 최소화 시키는 API함수들
1.
PostMessage(hWnd,WM_SYSCOMMAND,(WPARAM)SC_MINIMIZE,0); //최소화시키는 메시지 발생 (WM_SYSCOMMAND 메시지의 SC_MINIMIZE)
2.
ShowWindow(hWnd,SW_HIDE); //HIDE모드로 윈도우를 보여줌 -> 최소화
3.
CloseWindow(hWnd); //닫다 (최소화)
4.
SetWindowPos(hWnd,NULL,0,0,0,0,SWP_HIDEWINDOW); //나머지는 바탕화면DC얻고 캡쳐하면 찍히던데 이건 제대로 숨네요
//핸들,해당윈도우앞에있기,x,y,폭,높이,옵션
이 네 함수의 차이점은 모르곘네요..
나중에 알아봐야겠습니다
출처: http://hypen1117.tistory.com/entry/윈도우-최소화-시키는-함수들 [For the]
=================================
=================================
=================================
'프로그래밍 관련 > 언어들의 코딩들 C++ JAVA C# 등..' 카테고리의 다른 글
[C#] C++ 와 C# 형 비교 참조 Converting C++ Data Types to C# (0) | 2019.03.13 |
---|---|
[C#] 읽기/쓰기 속성 선언 및 사용 - get, set 사용 관련 (0) | 2019.03.12 |
C, C++ 시간 계산 관련 (0) | 2017.09.11 |
C/C++ 스레드 concurrent_vector, concurrent_queue, parallel_for, parallel_for_each 등등 관련 (0) | 2017.07.11 |
C/C++ 랜덤숫자, 난수 생성 함수 rand, srand 사용법 및 중복 없는 난수 생성 관련 (1) | 2017.07.06 |
댓글 영역