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

📄 outcfgdlg.cpp

📁 EVC应用程序
💻 CPP
字号:
// outcfgDlg.cpp : implementation file
//

#include "stdafx.h"
#include "outcfg.h"
#include "outcfgDlg.h"

#include <windows.h>

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

//-------------------------------------
// Definition copy from chrontel.h
//-------------------------------------
#define OEMES_CODEBASE			100000
#define DRVESC_DISPLAYPAGE				(OEMES_CODEBASE + 1)
#define DRVESC_GETPALETTERAMPHYSICAL	(OEMES_CODEBASE + 2)
#define DRVESC_VERTICALBLANKINTERRUPT	(OEMES_CODEBASE + 3)
#define DRVESC_OS_SCREENACCESS			(OEMES_CODEBASE + 4)  
#define DRVESC_SCROLL					(OEMES_CODEBASE + 5)

#define DRVESC_I2CRW                    (OEMES_CODEBASE + 100)
#define DRVESC_GETTIMING                (OEMES_CODEBASE + 101)
#define DRVESC_SETTIMING                (OEMES_CODEBASE + 102)
//
#define DRVESC_CHANGEVOEDEVICE           (OEMES_CODEBASE + 103)
#define DRVESC_GETDIMMENSION            (OEMES_CODEBASE + 104)
#define DRVESC_SAVEPOINTERS             (OEMES_CODEBASE + 105)
#define DRVESC_RESTOREPOINTERS          (OEMES_CODEBASE + 106)
#define DRVESC_SHOWCOLORBAR             (OEMES_CODEBASE + 107)
#define DRVESC_GETVOEABILITY            (OEMES_CODEBASE + 108)
#define DRVESC_GETVOEDEVICE             (OEMES_CODEBASE + 109)

// VOD device attribute byte
#define VOD_ATTR_INVALID 0x0	
#define VOD_ATTR_DEFAULT 0x10  // default device w/o VOD (eg. STN/TFT panel)

#define VOD_ATTR_TV      0x08  // Output to TV
#define VOD_ATTR_VGA     0x04  // Output to CRT/VGA bypass 
#define VOD_ATTR_DVI     0x02  // Output to DVI 
#define VOD_ATTR_LVDS    0x01  // Output to LVDS

#define VOD_ATTR_CHVOE   0x0F  // Output to TV/VGA/DVI/LVDS mask

int doop = 0;
//----------------------------------------------------------------
// Display driver interface
//----------------------------------------------------------------
// send Escape code to display driver
int dispEscape( 
    int nEscape,        //[in] Handle to the device context. 
    int cbInput,        //[in] Specifies the escape function to be performed. 
    LPCSTR lpszInData,  //[in] Specifies the number of bytes of data pointed to by the lpszInData parameter.
    int cbOutput,       //[in] Specifies the number of bytes of data pointed to by the lpszOutData parameter.
    LPSTR lpszOutData   //[out] Long pointer to the structure that receives output from this escape. 
)
{
	HDC hdc;
	int result;
//	hdc = GetDC(NULL);
    hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL);

	if (NULL!=hdc) result=ExtEscape( hdc, nEscape, cbInput, lpszInData, cbOutput, lpszOutData);

    DeleteDC( hdc);
//	ReleaseDC( NULL, hdc);
	return result;
}


__forceinline void vos_ChangeVOEDevice(unsigned device)
{
    dispEscape( DRVESC_CHANGEVOEDEVICE,
	                 sizeof(unsigned), (LPCSTR)&device, 
			 0, NULL
			   );
	return;
}

__forceinline unsigned vos_GetVOEDevice()
{
    unsigned v;
	dispEscape( DRVESC_GETVOEDEVICE,
	            0, NULL,
		        sizeof(unsigned), (LPSTR)&v 
			   );
	return v;
}

__forceinline unsigned vos_GetVOEAbility()
{
    unsigned v;
	dispEscape( DRVESC_GETVOEABILITY,
	            0, NULL,
		        sizeof(unsigned), (LPSTR)&v 
			   );
	return v;
}


/////////////////////////////////////////////////////////////////////////////
// COutcfgDlg dialog

COutcfgDlg::COutcfgDlg(CWnd* pParent /*=NULL*/)
	: CDialog(COutcfgDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(COutcfgDlg)
	m_voe = -1;
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void COutcfgDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(COutcfgDlg)
	DDX_Radio(pDX, IDC_VOD_STN, m_voe);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(COutcfgDlg, CDialog)
	//{{AFX_MSG_MAP(COutcfgDlg)
	ON_BN_CLICKED(IDC_VOD_STN, OnVodStn)
	ON_BN_CLICKED(IDC_VOD_TV, OnVodTv)
	ON_BN_CLICKED(IDC_VOD_CRT, OnVodCrt)
	ON_BN_CLICKED(IDC_VOD_DVI, OnVodDvi)
	ON_BN_CLICKED(IDC_VOD_LVDS, OnVodLvds)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// COutcfgDlg message handlers

BOOL COutcfgDlg::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
	
	CenterWindow(GetDesktopWindow());	// center to the hpc screen

	// TODO: Add extra initialization here	
	unsigned oc, oa;

	oa = vos_GetVOEAbility();
	oc = vos_GetVOEDevice();

	doop = 0;


	if (oa & VOD_ATTR_DEFAULT) GetDlgItem(IDC_VOD_STN)->EnableWindow(TRUE);
	else GetDlgItem(IDC_VOD_STN)->EnableWindow(FALSE);
 
	if (oa & VOD_ATTR_TV) GetDlgItem(IDC_VOD_TV)->EnableWindow(TRUE);
	else GetDlgItem(IDC_VOD_TV)->EnableWindow(FALSE);

    if (oa & VOD_ATTR_VGA) GetDlgItem(IDC_VOD_CRT)->EnableWindow(TRUE);
	else GetDlgItem(IDC_VOD_CRT)->EnableWindow(FALSE);

    if (oa & VOD_ATTR_DVI) GetDlgItem(IDC_VOD_DVI)->EnableWindow(TRUE);
	else GetDlgItem(IDC_VOD_DVI)->EnableWindow(FALSE);

    if (oa & VOD_ATTR_LVDS) GetDlgItem(IDC_VOD_LVDS)->EnableWindow(TRUE);
	else GetDlgItem(IDC_VOD_LVDS)->EnableWindow(FALSE);
	
/*
    if (oc & VOD_ATTR_LVDS) m_voe =4;
    if (oc & VOD_ATTR_DVI)  m_voe =3;
    if (oc & VOD_ATTR_VGA)  m_voe =2;
    if (oc & VOD_ATTR_TV)   m_voe =1;
    if (oc & VOD_ATTR_DEFAULT) m_voe =0;
*/

    if (oc & VOD_ATTR_LVDS) ((CButton*)GetDlgItem(IDC_VOD_LVDS))->SetCheck(BST_CHECKED);
    if (oc & VOD_ATTR_DVI)  ((CButton*)GetDlgItem(IDC_VOD_DVI))->SetCheck(BST_CHECKED);;
    if (oc & VOD_ATTR_VGA)  ((CButton*)GetDlgItem(IDC_VOD_CRT))->SetCheck(BST_CHECKED);;
    if (oc & VOD_ATTR_TV)   ((CButton*)GetDlgItem(IDC_VOD_TV))->SetCheck(BST_CHECKED);;
    if (oc & VOD_ATTR_DEFAULT) ((CButton*)GetDlgItem(IDC_VOD_STN))->SetCheck(BST_CHECKED);;

	doop = 1;
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}



void COutcfgDlg::OnVodStn() 
{
	// TODO: Add your control notification handler code here
	if (doop) vos_ChangeVOEDevice(VOD_ATTR_DEFAULT);
}

void COutcfgDlg::OnVodTv() 
{
	// TODO: Add your control notification handler code here
	if (doop) vos_ChangeVOEDevice(VOD_ATTR_TV);
	
}

void COutcfgDlg::OnVodCrt() 
{
	// TODO: Add your control notification handler code here
	if (doop) vos_ChangeVOEDevice(VOD_ATTR_VGA);
	
}

void COutcfgDlg::OnVodDvi() 
{
	// TODO: Add your control notification handler code here
	if (doop) vos_ChangeVOEDevice(VOD_ATTR_DVI);
	
}

void COutcfgDlg::OnVodLvds() 
{
	// TODO: Add your control notification handler code here
	if (doop) vos_ChangeVOEDevice(VOD_ATTR_LVDS);
	
}

⌨️ 快捷键说明

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