Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 3rd, 2006, 02:41 AM
Authorized User
 
Join Date: Apr 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Document Class pointer error

Hi,

I am using embedde visual C++ and I have create a dialog box and a button call ID_BInsert.

Below is the code for button ID_BInsert:
-------------------------------------------------------------------------------------

void CNEWSERIALNO::OnBInsert()
{
// TODO: Add your control notification handler code here

CTokenEx tok;
CStringArray arr_SerialNo;

UpdateData (TRUE);
CString sSerialNo(m_sSerialNo);

tok.Split(sSerialNo, "\r\n", arr_SerialNo, FALSE);

CMobileInventoryDoc* pDoc = GetDocument();

for (int i =0; i < arr_SerialNo.GetSize(); i++)
{
AfxMessageBox(arr_SerialNo[i], MB_OK);

if (pDoc)
{
// Get the last record from the document
m_pCurItem = pDoc->GetLastRecord();
if (m_pCurItem)
{
m_pCurItem = pDoc->GetNextRecord();
if (m_pCurItem)
m_pCurItem->SetSerialNo(arr_SerialNo[i]);
}
}
}
}

-------------------------------------------------------------------------------------

When I compile and build the application, it give me the error as below:

C:\Documents and Settings\user1\My Documents\MobileInventory\NEWSERIALNO.cpp(61) : error C2065: 'GetDocument' : undeclared identifier
C:\Documents and Settings\user1\My Documents\MobileInventory\NEWSERIALNO.cpp(61) : error C2440: 'initializing' : cannot convert from 'int' to 'class CMobileInventoryDoc *'

The statement that cause the error is statement below:
CMobileInventoryDoc* pDoc = GetDocument();

But I have use this statement in view class and it is no problem.

May someone tell me what is the problem and how to solve it.

Thanks in advance.

Best Regards.

 
Old May 3rd, 2006, 03:20 PM
Authorized User
 
Join Date: Mar 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to skoob1152 Send a message via Yahoo to skoob1152
Default

It is hard to find the problem, but looks like you have (C:\Documents and Settings\user1\My Documents\MobileInventory\NEWSERIALNO.cpp(61) : error C2065: 'GetDocument' : undeclared identifier ) a member or variable error; check your spelling on members and variables aven functions.

 
Old May 3rd, 2006, 10:02 PM
Authorized User
 
Join Date: Apr 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for reply.

Actually what I want to do is get a pointer to current active document from dialog box.

However, I have solved the problem.

Thank you.

 
Old July 5th, 2006, 05:10 AM
Registered User
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi ... I have the same errors with you

F:\Read Image\Bmp-test\testFDoc.cpp(117) : error C2065: 'GetDocument' : undeclared identifier

F:\Read Image\Bmp-test\testFDoc.cpp(117) : error C2440: 'initializing' : cannot convert from 'int' to 'class CTestFDoc *

May you tell me how to solve it ?

Thank you






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9 - Error Document tbrown Beginning PHP 4 December 29th, 2006 12:12 AM
error with pointer code XeeTu C++ Programming 2 December 7th, 2006 11:41 PM
Xpath error in Document() bonekrusher XSLT 13 September 30th, 2006 02:39 AM
document.DocumentElement.RemoveChild Error jrbancroft C# 2005 2 August 7th, 2006 10:36 PM
XML document error jaffir BOOK: ASP.NET Website Programming Problem-Design-Solution 2 July 26th, 2005 12:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.