usingblobdoc.cpp

来自「< VISUAL C++ 数据库编程技术与实例>> 配套源码 」· C++ 代码 · 共 80 行

CPP
80
字号
// UsingBlobDoc.cpp : implementation of the CUsingBlobDoc class
//

#include "stdafx.h"
#include "UsingBlob.h"

#include "UsingBlobDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CUsingBlobDoc

IMPLEMENT_DYNCREATE(CUsingBlobDoc, CDocument)

BEGIN_MESSAGE_MAP(CUsingBlobDoc, CDocument)
	//{{AFX_MSG_MAP(CUsingBlobDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CUsingBlobDoc construction/destruction

CUsingBlobDoc::CUsingBlobDoc()
{
	// TODO: add one-time construction code here

}

CUsingBlobDoc::~CUsingBlobDoc()
{
}

/////////////////////////////////////////////////////////////////////////////
// CUsingBlobDoc diagnostics

#ifdef _DEBUG
void CUsingBlobDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CUsingBlobDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CUsingBlobDoc commands

BOOL CUsingBlobDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	if (!CDocument::OnOpenDocument(lpszPathName))
		return FALSE;
	
    HBITMAP hbm = (HBITMAP)::LoadImage(NULL,
                                       lpszPathName,
                                       IMAGE_BITMAP,
                                       0,
                                       0,
                                       LR_LOADFROMFILE);

    if  (m_Image.Attach(hbm))
    {
        BITMAP  bm;
        m_Image.GetBitmap(&bm);
        m_Image.SetBitmapDimension(bm.bmWidth,bm.bmHeight);
        return TRUE;
    }

    return FALSE;
}

⌨️ 快捷键说明

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