Solved

error when Calling SubReport in VC++ by using ComponentOne VSView 7.0

Posted on 2003-10-25
4
334 Views
Last Modified: 2012-06-27
hi experts..
i have a problem when compile my code the error in this function
 
CVSReport CField::GetSubreport()
{
 LPDISPATCH pDispatch;
 InvokeHelper(0x27, DISPATCH_PROPERTYGET, VT_DISPATCH, (void*)&pDispatch, NULL);
 return CVSReport(pDispatch);
}
 
the error is
//////////
: error C2440: 'type cast' : cannot convert from 'struct IDispatch *' to 'class CVSReport'
        No constructor could take the source type, or constructor overload resolution was ambiguous
Error executing cl.exe.
//////////
 
plz tell me how i can solve this problem ?!?
 
with regard
 
sanad
0
Comment
Question by:Sanad78
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 9619237
Assuiming error is in the line

return CVSReport(pDispatch);

(you don't write this, I just guess):
What do you want to return? CVSReport instance? In the case you can write:

return new CVSReport(...);

and client should release the instance after using. When you write CVSReport(pDispatch), you actually call CVSRrport construtor:

CVSReport::CVSReport(LPDISPATCH pDispatch)

Do you have such constructor in CVSReport class?
0
 

Author Comment

by:Sanad78
ID: 9622207
thanx Mr AlexFM ...
 
i know i am not write this code ... this code come from ComponentOne
when u add the ActiveX Control (VSReport, VSPrinter)
 
the code in the .h file for CVSReport is
///////////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_VSREPORT_H__6303DD5F_1F48_420C_8AFC_8A939A7CADE1__INCLUDED_)
#define AFX_VSREPORT_H__6303DD5F_1F48_420C_8AFC_8A939A7CADE1__INCLUDED_
 
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
 
// NOTE: Do not modify the contents of this file.  If this class is regenerated by
//  Microsoft Visual C++, your modifications will be overwritten.
 

// Dispatch interfaces referenced by this interface
class CLayout;
class CDataSource;
class CGroupCollection;
class CSectionCollection;
class CFieldCollection;
class COleFont;
 
// CVSReport wrapper class
 
class CVSReport : public CWnd
{
protected:
 DECLARE_DYNCREATE(CVSReport)
public:
 CLSID const& GetClsid()
 {
  static CLSID const clsid
   = { 0x3a6f7f8d, 0x45e5, 0x11d4, { 0xac, 0x3e, 0xad, 0xbc, 0xe8, 0xb3, 0x4, 0x10 } };
  return clsid;
 }
 virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL)
 {
  return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID);
 }
 
    BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL)
 {
  return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID, pPersist, bStorage, bstrLicKey);
 }
 
// Attributes
public:
// Operations
public:
 CString GetReportName();
 ....
};
 
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
 
#endif // !defined(AFX_VSREPORT_H__6303DD5F_1F48_420C_8AFC_8A939A7CADE1__INCLUDED_)
 
///////////////////////////////////////////////////////////////////////
 
i tired to write
////////////////////////////////////////////
CVSReport() {}  // Calls COleDispatchDriver default constructor
CVSReport(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CVSReport(const CVSReport& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
////////////////////////////////////////////
but there is errors in the files where used that activeX controls
 
and thank u again sir
 
sanad
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10546140
No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 10586129
PAQed, with points refunded (80)

ee_ai_construct
Community Support Moderator
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question