بسم الله الرحمن الرحيم
الى الاخوة الاعزاء السلام عليكم ورحمة الله وبركاته
موضوعي هو اني قمت بانشاء برنامج يقوم بفتح نافذة وكل ماكتبه بواسطة لوحة المفاتيح يظهر
لكن المشكلة انه عند التنفيذ تظهر اخطاء هذه الاخطاء هي كالتالي
[code2]
--------------------Configuration: keystrokes - Win32 Debug--------------------
Compiling...
keystrokesView.cpp
D:vcppkeystrokeskeystrokesView.cpp(59) : error C2228: left of '.pDoc' must have class/struct/union type
D:vcppkeystrokeskeystrokesView.cpp(59) : error C2227: left of '->StringData' must point to class/struct/union
D:vcppkeystrokeskeystrokesView.cpp(59) : error C2661: 'TextOutA' : no overloaded function takes 1 parameters
D:vcppkeystrokeskeystrokesView.cpp(113) : error C2143: syntax error : missing ';' before ':'
Error executing cl.exe.
keystrokes.exe - 4 error(s), 0 warning(s)
[/code2]
اما بنسبه لشفرة فهي كالتالي
[code2]
// keystrokesView.cpp : implementation of the CKeystrokesView class
//
#include "stdafx.h"
#include "keystrokes.h"
#include "keystrokesDoc.h"
#include "keystrokesView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CKeystrokesView
IMPLEMENT_DYNCREATE(CKeystrokesView, CView)
BEGIN_MESSAGE_MAP(CKeystrokesView, CView)
//{{AFX_MSG_MAP(CKeystrokesView)
ON_WM_CHAR()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CKeystrokesView construction/destruction
CKeystrokesView::CKeystrokesView()
{
// TODO: add construction code here
}
CKeystrokesView::~CKeystrokesView()
{
}
BOOL CKeystrokesView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CKeystrokesView drawing
void CKeystrokesView::OnDraw(CDC* pDC)
{
CKeystrokesDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->TextOut(0.0.pDoc->StringData);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CKeystrokesView printing
BOOL CKeystrokesView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CKeystrokesView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CKeystrokesView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CKeystrokesView diagnostics
#ifdef _DEBUG
void CKeystrokesView::AssertValid() const
{
CView::AssertValid();
}
void CKeystrokesView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CKeystrokesDoc* CKeystrokesView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CKeystrokesDoc)));
return (CKeystrokesDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CKeystrokesView message handlers
void CKeystrokesView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CKeystrokesDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
pDoc->StringData+=nChar;
:Invalidate()
CView::OnChar(nChar, nRepCnt, nFlags);
}
[/code2]
فقمت بحذف الجملة pDC->TextOut(0.0.pDoc->StringData); فذهبت كل الاخطاء لكن لم استطع الكتابة
فكيف اعمل
وشكرا
ارجاء من الاخوة التفصيل الممل لكوني مبتدى وشكرا