2013년 1월 19일 토요일

'OnCreateClient' : member function not declared in 'CMainFrame'

virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);를 추기
// Overrides
 // ClassWizard generated virtual function overrides
 //{{AFX_VIRTUAL(CMainFrame)
 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
 virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
 //}}AFX_VIRTUAL

2013년 1월 18일 금요일

광전효과


1) 아인슈타인의 광양자설에 따르면 A에 단위시간당 입사하는 광자의 수는 얼마인가
$$e=hf = \frac{hc}{\lambda}$$

$$Nr = \frac{P}{e} = \frac{P\lambda}{hc}$$

2) 광자 한 개가 입사할 때 전자가 1/2eV0보다 큰 운동에너지를 가지고 금속 A로부터 튀어나올 확률을 구하시오

답: 정지전압이 1/2V0일 때에도 C에 도달할 수 있는 전자는 A에서 1/2eV0보다 큰 운동에너지를 가지고 튀어나온 전자이다. 따라서 현재의 실험에서 1/2eV0보다 큰 운동에너지를 가지고 금속 A에서 단위 시간에 튀어나오는 전자의 개수는 Ne=2/3 I0/e이다. P = Ne/Nr = 2/3 I0hc/eP*lamda

2013년 1월 17일 목요일

압축테스트

// TZ1Doc.cpp : implementation of the CTZ1Doc class
//

#include "stdafx.h"
#include "TZ1.h"

#include "TZ1Doc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CTZ1Doc

IMPLEMENT_DYNCREATE(CTZ1Doc, CDocument)

BEGIN_MESSAGE_MAP(CTZ1Doc, CDocument)
 //{{AFX_MSG_MAP(CTZ1Doc)
 ON_COMMAND(ID_FILE_NEW, OnFileNew)
 //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTZ1Doc construction/destruction

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

}

CTZ1Doc::~CTZ1Doc()
{
}

BOOL CTZ1Doc::OnNewDocument()
{
 if (!CDocument::OnNewDocument())
  return FALSE;

 // TODO: add reinitialization code here
 // (SDI documents will reuse this document)

 return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CTZ1Doc serialization

void CTZ1Doc::Serialize(CArchive& ar)
{
 if (ar.IsStoring())
 {
  // TODO: add storing code here
 }
 else
 {
  // TODO: add loading code here
 // CFile *fp = ar.GetFile();
 // ar.Read(m_Input, fp->GetLength());

 }
}

/////////////////////////////////////////////////////////////////////////////
// CTZ1Doc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CTZ1Doc commands

void CTZ1Doc::OnFileNew() 
{
 // TODO: Add your command handler code here
  char szFilter[] = "All Files(*.*)|*.*||";
 CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, szFilter);
 if(IDOK == dlg.DoModal())
 {
  CString strPathName = dlg.GetPathName();
  CFile fp;
  CFileException e;
 if(!fp.Open(strPathName, CFile::modeRead, &e)) {
  e.ReportError();
   return;
      }
 char str[200];

 fp.Read(str, 100);

 m_Input += str;
 
//////////////////////////////
 // Writing
 if (!gzip.Open(_T("gziptest.txt.gz"), CGZip::ArchiveModeWrite))
 {
  AfxMessageBox("Could not create file\n");
  exit(-1);
 }
 printf(_T("\tFile opening success\n"));

 // writing test string....
 if (!gzip.WriteString(m_Input))
 {
  AfxMessageBox("Could not write test string\n");
  exit(-1);
 }
 printf(_T("\tString writing success\n"));

 if (!gzip.Close())
 {
  printf(_T("Could not close file\n"));
  exit(-1);
 }
 printf(_T("\tFile closing success\n"));

 ///////////////
 fp.Close();

 UpdateAllViews(NULL);
 }
}

2013년 1월 14일 월요일

압축유틸 새로압축



// TZ1Doc.cpp : implementation of the CTZ1Doc class
//

#include "stdafx.h"
#include "TZ1.h"

#include "TZ1Doc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CTZ1Doc

IMPLEMENT_DYNCREATE(CTZ1Doc, CDocument)

BEGIN_MESSAGE_MAP(CTZ1Doc, CDocument)
 //{{AFX_MSG_MAP(CTZ1Doc)
 ON_COMMAND(ID_FILE_NEW, OnFileNew)
 //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTZ1Doc construction/destruction

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

}

CTZ1Doc::~CTZ1Doc()
{
}

BOOL CTZ1Doc::OnNewDocument()
{
 if (!CDocument::OnNewDocument())
  return FALSE;

 // TODO: add reinitialization code here
 // (SDI documents will reuse this document)

 return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CTZ1Doc serialization

void CTZ1Doc::Serialize(CArchive& ar)
{
 if (ar.IsStoring())
 {
  // TODO: add storing code here
 }
 else
 {
  // TODO: add loading code here
 // CFile *fp = ar.GetFile();
 // ar.Read(m_Input, fp->GetLength());

 }
}

/////////////////////////////////////////////////////////////////////////////
// CTZ1Doc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CTZ1Doc commands

void CTZ1Doc::OnFileNew() 
{
 // TODO: Add your command handler code here
  char szFilter[] = "All Files(*.*)|*.*||";
 CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, szFilter);
 if(IDOK == dlg.DoModal())
 {
  CString strPathName = dlg.GetPathName();
  CFile fp;
  CFileException e;
 if(!fp.Open(strPathName, CFile::modeRead, &e)) {
  e.ReportError();
   return;
      }
  char str[200];

 fp.Read(str, 100);

 m_Input += str;

 fp.Close();

 UpdateAllViews(NULL);
 }
}