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

📄 albumdlg.cpp

📁 Windows ce 5.0 (MIPS架构)自动全屏播放相册
💻 CPP
字号:
// AlbumDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Album.h"
#include "AlbumDlg.h"
#include <initguid.h>
#include <imaging.h>

//#pragma comment (lib,"Ole32.lib")

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

/////////////////////////////////////////////////////////////////////////////
// CAlbumDlg dialog

CAlbumDlg::CAlbumDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CAlbumDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAlbumDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CAlbumDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAlbumDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAlbumDlg, CDialog)
	//{{AFX_MSG_MAP(CAlbumDlg)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAlbumDlg message handlers

BOOL CAlbumDlg::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
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}



void CAlbumDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	CRect   rcWnd;
	
	GetWindowRect(&rcWnd);
	// TODO: Add your message handler code here
    IImage * m_pImage;
	IImagingFactory * m_pImagingFactory;
    
	HRESULT hr;
	//COM初始化
    if (FAILED(hr = CoInitializeEx(NULL, COINIT_MULTITHREADED)))
	{ 
        goto END;
	}
	//创建COM实例
    if(FAILED(hr = CoCreateInstance(CLSID_ImagingFactory,NULL,CLSCTX_INPROC_SERVER,IID_IImagingFactory,(void**)
		&m_pImagingFactory)))
	{
        goto END;
	}
	//从文件中创建图片
    if(FAILED(hr = m_pImagingFactory->CreateImageFromFile(TEXT("\\play.gif"), &m_pImage)))
	{
        goto END;
	}
    //绘制图片
    if(FAILED(hr = m_pImage->Draw(dc,&rcWnd,NULL)))//NULL 决定图片显示的大小
	{
		goto END;
	}
    
    
END:
	//释放资源
    if(m_pImage != NULL)
	{
		m_pImage->Release();
		m_pImage = NULL;
	}
    if(m_pImagingFactory != NULL)
	{
		m_pImagingFactory->Release();
		m_pImagingFactory = NULL;
	}
	CoUninitialize();
	// Do not call CDialog::OnPaint() for painting messages


	// Do not call CDialog::OnPaint() for painting messages
}

⌨️ 快捷键说明

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