ATL中CString,list怎么使用,包含哪个头文件中?在idl文件中要定义结构体,可是系统无法识别这两个结构?
有人说用ATL::cstring可是编绎不过,是不是需要头文件什么的?
请高手指点
有人说用ATL::cstring可是编绎不过,是不是需要头文件什么的?
请高手指点
解决方案 »
- 线程函数怎么调用其他类的成员及成员函数
- 无法删除schema.ini文件
- WebBrowser控件打开网页,如何屏蔽右键消息
- mfc中要实现工具栏的功能在面向对话框的工作区间行不行
- 工具栏的创建问题
- 在CEdit控件中用SendMessage发WM_CHAR消息模拟输入字符时问题,请老师解答!欢迎高手共同解决这个问题
- 有谁开发过用gsm模块发送短信的系统,帮我分析一下是什么原因
- 怎样向系统的右健菜单加入菜单项?就象winzip一样。还有就是怎样去掉?
- vc++运行出错问题-第三次提问--拜托别给无用答案--答案没有解决问题
- 用C++写了两个窗口,使其拥有拒绝关闭的能力,但是点击关闭的时候两个窗口都关闭了。
- ATL自定义结构体 在用SAFEARRAY时编绎:no GUID has been associated with this object
- Activex文件上传进度条
list是STL的模板类。
#include <list>
using namespace std;
我是在ATL COM中使用这些类型的,请再次指点。
IDL放CString,百分百编译不过,IDL只能放些COM规范类型
如果需要用到字符,应用BSTR,BSTR操作很费劲,如果在CPP里需要用到BSTR,用CComBSTR会比较舒服。
用list你是想用数组??
在IDL里用数组应用SAFEARRAY,对应的封装类应用CComSafeArray,此类在atlsafe.h里面。
其中sc_dev,sc_result都是自定义结构体,里面包含CString,list类型?
网上很多地方说,自定义的结构要在IDL中定义,那么这个结构体怎么实现?
hr=GetRecordInfoFromGuids(LIBID_SUCLib,1,0,GetUserDefaultLCID(),__uuidof(SCEInfo),&pRecordInfo);处出错,VC提示:
C:\Program Files\Microsoft Visual Studio\MyProjects\suc\success.cpp(26) : error C2787: 'SCE_Info' : no GUID has been associated with this object
还望高手指点。下面是IDL文件。import "oaidl.idl";
import "ocidl.idl";
#include "olectl.h"
[
uuid(D124B04A-C5F9-4a16-9671-1E67B75DB1A1) ]
typedef struct SCE_Info
{
BSTR ID;
BSTR name;
BSTR driver_version;
BSTR provider_name;
}SCEInfo; [
uuid(D124B04A-C5F9-4a16-9671-1E67B75DB1A2)
]
typedef struct sc_Standard
{
long SC_STAND_ID;
BSTR SC_STAND_Ver;
BSTR Comments;
BSTR SPEC_CODE;
BSTR CHECK_PART;
BSTR CHECK_ITEM;
BSTR CHECK_CONTENT;
BSTR EST_STANDARD;
int SC_type;
int DATA_TYPE_ID;
BSTR DATA_UNIT_ID;
BSTR resultList;
int CheckMethod;
float WARN_LOWER;
float WARN_UPPER;
float ALARM_LOWER;
float ALARM_UPPER;
int Check_Cont;
}SC_Standard;
[
uuid(D124B04A-C5F9-4a16-9671-1E67B75DB1A3)
]
typedef struct sc_dev
{
BSTR devID;
BSTR devName;
SAFEARRAY *standards;
}SC_DEV;
[
uuid(D124B04A-C5F9-4a16-9671-1E67B75DB1A4)
]
typedef struct sc_zero
{
BSTR ID;
BSTR Zero_CODE;
BSTR ZeroName;
SAFEARRAY *Devs;
}SC_Zero;
[
uuid(D124B04A-C5F9-4a16-9671-1E67B75DB1A6)
]
typedef struct sc_result{
long SC_StandardID;
BSTR PlanID;
BSTR COMPLETE_TM;
int DEV_status;
int USER_ID;
int DATA_TYPE_ID;
byte resultData;
byte resultDataEx;
BSTR Memo;}SC_RESULT;
[
uuid(D124B04A-C5F9-4a16-9671-1E67B75DB1A5)
]
typedef struct SC_Line
{
int ID;
BSTR name;
int Specialty;
int gangwei;
BSTR executorID;
BSTR SC_Period;
int SC_type;
BSTR starttime;
BSTR lastStartTime;
BSTR lastEndTime;
SAFEARRAY *Zeroes;}SCLine;
[
object,
uuid(7A6EA7DF-5D06-4DE2-B354-655612C1F8B9),
dual,
helpstring("Isuccess Interface"),
pointer_default(unique)
]
interface Isuccess : IDispatch
{
[id(1), helpstring("method Test")] HRESULT Test();
};[
uuid(286E923E-611F-48D7-B84C-6BF96E935624),
version(1.0),
helpstring("suc 1.0 Type Library")
]
library SUCLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb"); [
uuid(877DBFC7-6574-45D1-90B9-C5EDAAAF4B4E),
helpstring("success Class")
]
coclass success
{
[default] interface Isuccess;
};
};
http://www.codeproject.com/KB/atl/udtdemo.aspx