⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 idl_rotatedlg.cpp

📁 Visual Studio 2005 Windows CE screen rotation utility. From landscape to Portrait mode.
💻 CPP
字号:
// idl_RotateDlg.cpp : implementation file
//

#include "stdafx.h"
#include "idl_Rotate.h"
#include "idl_RotateDlg.h"
#include  <iostream>

using namespace std;

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

// Cidl_RotateDlg dialog

BYTE g_orientation[4] = {0, 1, 2, 4}; 
BYTE i = 0;

Cidl_RotateDlg::Cidl_RotateDlg(CWnd* pParent /*=NULL*/)
	: CDialog(Cidl_RotateDlg::IDD, pParent)
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void Cidl_RotateDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(Cidl_RotateDlg, CDialog)
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
	ON_WM_SIZE()
#endif
	//}}AFX_MSG_MAP
	ON_BN_CLICKED(IDC_BUTTON1, &Cidl_RotateDlg::OnBnClickedButton1)
END_MESSAGE_MAP()


// Cidl_RotateDlg message handlers

BOOL Cidl_RotateDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
void Cidl_RotateDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/)
{
	if (AfxIsDRAEnabled())
	{
		DRA::RelayoutDialog(
			AfxGetResourceHandle(), 
			this->m_hWnd, 
			DRA::GetDisplayMode() != DRA::Portrait ? 
			MAKEINTRESOURCE(IDD_IDL_ROTATE_DIALOG_WIDE) : 
			MAKEINTRESOURCE(IDD_IDL_ROTATE_DIALOG));
	}
}
#endif


void Cidl_RotateDlg::OnBnClickedButton1()
{
	//
	// Change the position of the screen
	//


	DEVMODE DeviceMode;
	    
	memset(&DeviceMode, NULL, sizeof(DeviceMode));
	DeviceMode.dmSize=sizeof(DeviceMode);
	DeviceMode.dmFields = DM_DISPLAYORIENTATION;

    i++;
    if (i > 3) i = 0;
	DeviceMode.dmDisplayOrientation = g_orientation[i]; //Put your desired 
						   //position right here.

	if (DISP_CHANGE_SUCCESSFUL == ChangeDisplaySettingsEx(
								NULL,
								&DeviceMode,
								NULL,
								CDS_RESET,
								NULL
								 )
	   )
	{
	   //Screen was rotated successfully
	}
	else
	{	
		//Screen could not be rotated
	}

	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -