#include <olectl.h>
#include <idispids.h>[ uuid(A4F5A21C-D400-419D-AC96-966B1F934CD4), version(1.0),
helpfile("pingcontrol1.hlp"),
helpstring("pingcontrol1 ActiveX Control module"),
control ]
library PINGCONTROL1Lib
{
importlib(STDOLE_TLB);
importlib(STDTYPE_TLB); // Primary dispatch interface for CPingcontrol1Ctrl [ uuid(018FC0F0-D379-45F9-AA3F-49408BF61638),
helpstring("Dispatch interface for Pingcontrol1 Control"), hidden ]
dispinterface _DPingcontrol1
{
properties:
// NOTE - ClassWizard will maintain property information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_PROP(CPingcontrol1Ctrl)
//}}AFX_ODL_PROP methods:
// NOTE - ClassWizard will maintain method information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_METHOD(CPingcontrol1Ctrl)
//}}AFX_ODL_METHOD [id(DISPID_ABOUTBOX)] void AboutBox();
}; // Event dispatch interface for CPingcontrol1Ctrl [ uuid(CDBEAB87-2E7C-421A-8E8C-FA6C594FDDCA),
helpstring("Event interface for Pingcontrol1 Control") ]
dispinterface _DPingcontrol1Events
{
properties:
// Event interface has no properties methods:
// NOTE - ClassWizard will maintain event information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_EVENT(CPingcontrol1Ctrl)
//}}AFX_ODL_EVENT
}; // Class information for CPingcontrol1Ctrl [ uuid(088512AF-768B-4534-B9F9-3BC41F98E5CF),
helpstring("Pingcontrol1 Control"), control ]
coclass Pingcontrol1
{
[default] dispinterface _DPingcontrol1;
[default, source] dispinterface _DPingcontrol1Events;
};
//{{AFX_APPEND_ODL}}
//}}AFX_APPEND_ODL}}
};==================================================<html>
<head>
<title> </title>
</head>
<OBJECT ID= "pingcontrol1"
CLASSID= "clsid:A4F5A21C-D400-419D-AC96-966B1F934CD4"
CODEBASE= "pingcontrol1.ocx"
align=center>
</OBJECT>
<body>
</body>
</html>==================================================关键是clsid和id不知道设置的对不对,网页里面看不到控件
#include <idispids.h>[ uuid(A4F5A21C-D400-419D-AC96-966B1F934CD4), version(1.0),
helpfile("pingcontrol1.hlp"),
helpstring("pingcontrol1 ActiveX Control module"),
control ]
library PINGCONTROL1Lib
{
importlib(STDOLE_TLB);
importlib(STDTYPE_TLB); // Primary dispatch interface for CPingcontrol1Ctrl [ uuid(018FC0F0-D379-45F9-AA3F-49408BF61638),
helpstring("Dispatch interface for Pingcontrol1 Control"), hidden ]
dispinterface _DPingcontrol1
{
properties:
// NOTE - ClassWizard will maintain property information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_PROP(CPingcontrol1Ctrl)
//}}AFX_ODL_PROP methods:
// NOTE - ClassWizard will maintain method information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_METHOD(CPingcontrol1Ctrl)
//}}AFX_ODL_METHOD [id(DISPID_ABOUTBOX)] void AboutBox();
}; // Event dispatch interface for CPingcontrol1Ctrl [ uuid(CDBEAB87-2E7C-421A-8E8C-FA6C594FDDCA),
helpstring("Event interface for Pingcontrol1 Control") ]
dispinterface _DPingcontrol1Events
{
properties:
// Event interface has no properties methods:
// NOTE - ClassWizard will maintain event information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_EVENT(CPingcontrol1Ctrl)
//}}AFX_ODL_EVENT
}; // Class information for CPingcontrol1Ctrl [ uuid(088512AF-768B-4534-B9F9-3BC41F98E5CF),
helpstring("Pingcontrol1 Control"), control ]
coclass Pingcontrol1
{
[default] dispinterface _DPingcontrol1;
[default, source] dispinterface _DPingcontrol1Events;
};
//{{AFX_APPEND_ODL}}
//}}AFX_APPEND_ODL}}
};==================================================<html>
<head>
<title> </title>
</head>
<OBJECT ID= "pingcontrol1"
CLASSID= "clsid:A4F5A21C-D400-419D-AC96-966B1F934CD4"
CODEBASE= "pingcontrol1.ocx"
align=center>
</OBJECT>
<body>
</body>
</html>==================================================关键是clsid和id不知道设置的对不对,网页里面看不到控件
一般是coclass关键字前面的CLSID
2. 另外要打包成cab压缩文件,而不是直接'pingcontrol1.ocx'.
3. ID可以随便设置
4. 没事别搞什么属性化编程,这项技术ms都快抛弃的.而且整的代码自己看不懂,别人也看不懂
2. 另外要打包成cab压缩文件,而不是直接'pingcontrol1.ocx'.vc如何打包成cab压缩文件
http://www.builder.com.cn/2007/1105/606687.shtml
就像楼主的问题,要在WEB页面上插入ActiveX控件,如果不用控件的方式,还有其他办法能实现同样的功能吗?