Solved

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

Posted on 2003-10-25
4
328 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
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Embarcadero C++ Builder XE2 TDateTime 8 75
FMX enumerated colours 2 115
C++ Code Issue 4 25
How to add columns to a RAD Studio FMX grid at design time 1 4
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

860 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