水木社区手机版
首页
|版面-C++程序设计语言(CPlusPlus)|
新版wap站已上线
返回
1/1
|
转到
主题:错误 C2440 “<function-style-cast>”: 无法从“_Ty”转换为“
楼主
|
mazheng75
|
2022-11-20 05:28:27
|
展开
如何处理错误 C2440 “<function-style-cast>”: 无法从“_Ty”转换为“LPoint”
在vs2003没有报错 升级到vs2017就报错
--
FROM 123.113.225.*
3楼
|
mazheng75
|
2022-11-25 02:08:05
|
展开
我还没有搞定,哪位赐教一下 谢谢
【 在 mazheng75 的大作中提到: 】
: 如何处理错误 C2440 “<function-style-cast>”: 无法从“_Ty”转换为“LPoint”
: 在vs2003没有报错 升级到vs2017就报错
: [upload=1][/upload][upload=2][/upload][upload=3][/upload][upload=4][/upload]
--
FROM 123.113.225.*
5楼
|
mazheng75
|
2022-11-25 19:39:06
|
展开
/********************************************************************
created: 2005/05/13
created: 13:5:2005 15:45
filename: include\sysutils\variant.h
file path: include\sysutils
author: 陈闽峰
purpose: 定义一个可以代表类型动态改变的值。
*********************************************************************
Release Note :
*********************************************************************/
#pragma once
#include "afxdisp.h"
#include "types.h"
#include "string.h"
#include "datetime.h"
#include "ImageUID.h"
/*
* VARENUM usage key,
*
* * [V] - may appear in a LVariant
* * [T] - may appear in a TYPEDESC
* * [P] - may appear in an OLE property set
* * [S] - may appear in a Safe Array
*
*
* VT_EMPTY [V] [P] nothing
* VT_NULL [V] [P] SQL style Null
* VT_I2 [V][T][P][S] 2 byte signed int
* VT_I4 [V][T][P][S] 4 byte signed int
* VT_R4 [V][T][P][S] 4 byte real
* VT_R8 [V][T][P][S] 8 byte real
* VT_CY [V][T][P][S] currency
* VT_DATE [V][T][P][S] date
* VT_BSTR [V][T][P][S] OLE Automation string
* VT_DISPATCH [V][T] [S] IDispatch *
* VT_ERROR [V][T][P][S] SCODE
* VT_BOOL [V][T][P][S] True=-1, False=0
* VT_VARIANT [V][T][P][S] VARIANT *
* VT_UNKNOWN [V][T] [S] IUnknown *
* VT_DECIMAL [V][T] [S] 16 byte fixed point
* VT_RECORD [V] [P][S] user defined type
* VT_I1 [V][T][P][s] signed char
* VT_UI1 [V][T][P][S] unsigned char
* VT_UI2 [V][T][P][S] unsigned short
* VT_UI4 [V][T][P][S] unsigned long
* VT_I8 [T][P] signed 64-bit int
* VT_UI8 [T][P] unsigned 64-bit int
* VT_INT [V][T][P][S] signed machine int
* VT_UINT [V][T] [S] unsigned machine int
* VT_INT_PTR [T] signed machine register size width
* VT_UINT_PTR [T] unsigned machine register size width
* VT_VOID [T] C style void
* VT_HRESULT [T] Standard return type
* VT_PTR [T] pointer type
* VT_SAFEARRAY [T] (use VT_ARRAY in VARIANT)
* VT_CARRAY [T] C style array
* VT_USERDEFINED [T] user defined type
* VT_LPSTR [T][P] null terminated string
* VT_LPWSTR [T][P] wide null terminated string
* VT_FILETIME [P] FILETIME
* VT_BLOB [P] Length prefixed bytes
* VT_STREAM [P] Name of the stream follows
* VT_STORAGE [P] Name of the storage follows
* VT_STREAMED_OBJECT [P] Stream contains an object
* VT_STORED_OBJECT [P] Storage contains an object
* VT_VERSIONED_STREAM [P] Stream with a GUID version
* VT_BLOB_OBJECT [P] Blob contains an object
* VT_CF [P] Clipboard format
* VT_CLSID [P] A Class ID
* VT_VECTOR [P] simple counted array
* VT_ARRAY [V] SAFEARRAY*
* VT_BYREF [V] void* for local use
* VT_BSTR_BLOB Reserved for system use
* VT_RECT [V]
* VT_POINT [V]
* VT_SIZE [V]
*/
const VARTYPE VT_RECT = 0x8001;
const VARTYPE VT_POINT = 0x8002;
const VARTYPE VT_SIZE = 0x8003;
const VARTYPE VT_IMAGEUID = 0x8004;
//!\class LVariant
//!\brief LVariant类型能代表类型动态改变的值。
//!任意其他类型的一个变量静态地被约束为那个类型时,LVariant类型的一个变量可以在运行期
//!认为是不同类项的值。最常用时,在实际类型在编译时改变或未知时使用Lvariant类型。
class AFX_EXT_CLASS LVariant : public COleVariant
{
public:
LVariant();
LVariant(const VARIANT& varSrc);
LVariant(const LVariant& varSrc);
LVariant(const LDateTime& timeSrc);
LVariant(const AnsiString& src);
LVariant(const WideString& src);
LVariant(const COleCurrency& curSrc);
LVariant(const CByteArray& arrSrc);
LVariant(const CLongBinary& lbSrc);
LVariant(const RECT &rect);
LVariant(const LRect &Rect);
LVariant(const POINT &point);
LVariant(const LPoint &Point);
LVariant(const SIZE &size);
LVariant(const LSize &size);
LVariant(const LImageUID &UID);
LVariant(LPCITEMIDLIST pidl);
LVariant(LPCVARIANT pSrc);
LVariant(wchar_t* lpszSrc);
LVariant(char* lpszSrc);
LVariant(short* src);
LVariant(int* src);
LVariant(long* src);
LVariant(__int64 *src);
LVariant(float* src);
LVariant(double* src);
LVariant(BYTE* src);
LVariant(float fltSrc);
LVariant(double dblSrc);
LVariant(bool src);
LVariant(BYTE nSrc);
LVariant(short nSrc);
LVariant(int src);
LVariant(long lSrc);
LVariant(__int64 src);
LVariant(unsigned short src);
LVariant(unsigned int src);
LVariant(unsigned long src);
LVariant(unsigned __int64 src);
~LVariant();
bool IsArray() const;
bool IsEmpty() const;
bool IsNull() const;
VARTYPE Type() const;
LImageUID *ImageUID();
static void StringToVrArray(AnsiString &src,std::vector<LVariant> &dest);
static void VrArrayToString(std::vector<LVariant> &src,AnsiString &dest);
LVariant& operator =(const WideString& src);
LVariant& operator =(const AnsiString& src);
LVariant& operator =(const LDateTime& src);
LVariant& operator =(const LRect &Rect);
LVariant& operator =(const LPoint &Point);
LVariant& operator =(const LSize &size);
LVariant& operator =(const LImageUID &UID);
LVariant& operator =(bool);
LVariant& operator =(__int64);
LVariant& operator =(unsigned int);
LVariant& operator =(unsigned short);
LVariant& operator =(unsigned long);
LVariant& operator =(unsigned __int64);
LVariant& operator =(char* src);
LVariant& operator =(BYTE* src);
LVariant& operator =(int* src);
LVariant& operator =(long* src);
LVariant& operator =(float* src);
LVariant& operator =(double* src);
operator AnsiString() const;
operator LDateTime() const;
operator bool() const;
operator LRect();
operator LPoint();
operator LSize();
operator LImageUID();
operator BYTE() const;
operator BYTE*();
operator char() const;
operator double() const;
operator double*();
operator float() const;
operator float*();
operator int() const;
operator int*();
operator short() const;
operator short*();
operator long() const;
operator long*();
operator unsigned int() const;
operator unsigned int*();
operator unsigned short() const;
operator unsigned short*();
operator unsigned long() const;
operator unsigned long*();
private:
union{
RECT FRect;
POINT FPoint;
SIZE FSize;
};
LImageUID FUID;
VARTYPE FType;
};
// 不胜赐教 谢谢
【 在 KillnCov 的大作中提到: 】
: 你把LVar的完整头文件发出来
--
FROM 123.113.225.*
7楼
|
mazheng75
|
2022-11-25 21:29:40
|
展开
都加了 问题如旧 谢谢
【 在 foliver 的大作中提到: 】
: 你把LButtonDownEvent函数的参数加上const。
: LButtonDownEvent(const LPoint &point)。声明和实现都要修改。
:
--
FROM 123.113.225.*
9楼
|
mazheng75
|
2022-11-26 00:32:38
|
展开
【 在 foliver 的大作中提到: 】
: 我模拟了一下你的代码,再我的VS2022上没有任何问题
: class LPoint
: {
: ...................
--
修改:mazheng75 FROM 123.113.225.*
FROM 123.113.225.*
11楼
|
mazheng75
|
2022-11-26 19:47:08
|
展开
对 谢谢您的赐教
【 在 foliver 的大作中提到: 】
: 我知道原因了。
: 你的LVAR类型转化与LPoint的构造函数有歧义。显示指定一下就可以了
: 比如
: ...................
--
FROM 123.113.225.*
1/1
|
转到
选择讨论区
首页
|
分区
|
热推
BYR-Team
©
2010.
KBS Dev-Team
©
2011
登录完整版