Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 3rd, 2006, 02:41 AM
Authorized User
 
Join Date: Apr 2006
Location: , , .
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.

Reply With Quote
  #2 (permalink)  
Old May 3rd, 2006, 03:20 PM
Authorized User
 
Join Date: Mar 2006
Location: Tucson, AZ, USA.
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.

Reply With Quote
  #3 (permalink)  
Old May 3rd, 2006, 10:02 PM
Authorized User
 
Join Date: Apr 2006
Location: , , .
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.

Reply With Quote
  #4 (permalink)  
Old July 5th, 2006, 05:10 AM
Registered User
 
Join Date: Jul 2006
Location: cungli, , Taiwan.
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:23 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.