关于加控件的问题,请求您的指点。

weixin12 2002-08-20 06:00:35
用VC的MFC ACTIVEX CONTROL WIZARD做一个控件,工程名为line,功能就是画一条线。CLineCtrl类的OnDraw函数如下:
void CLineCtrl::OnDraw(
CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
// TODO: Replace the following code with your own drawing code.
pdc->FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH)));
pdc->Ellipse(rcBounds);
pdc->LineTo (50,120);
}
其中只有 pdc->LineTo (50,120); 是后添的,执行后通过,将生成的Line.ocx在C:\WINDOWS\SYSTEM\inetsrv中注册成功。
在ASP中使用语句:
<http>
<body>
<%
set mtstest=server.createobject("line.ClineCtrl")
mtstest.ondrow
set mtstest=nothing
%>
</body>
</http>
为什么告诉我创建对象失败呢?怎么才能让图形在浏览器中显示呢?
...全文
30 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
antshome 2002-09-17
  • 打赏
  • 举报
回复
没弄清楚ASP的工作原理,努力啊
BrightEye 2002-09-17
  • 打赏
  • 举报
回复
gz!up!
xjbx 2002-08-21
  • 打赏
  • 举报
回复
你的脚本:<%
set mtstest=server.createobject("line.ClineCtrl")
mtstest.ondrow
set mtstest=nothing
%>

是在服务器上执行,我假定可以注册在服务器上,但是执行也就会在服务器上,我们如何可以看到结果呢?本地什么也看不到!更何况不能注册在服务器上呢?
xjbx 2002-08-20
  • 打赏
  • 举报
回复
我觉得你的问题是:不能在服务器上使用这个组件!(服务器你远程没法注册)

要使用的话,也是在本地!

修改如下:
<script language=vbscript>
sub drow()
set mtstest=createobject("line.ClineCtrl")
mtstest.ondrow
set mtstest=nothing
end sub()

然后再调用这个过程
yonghengdizhen 2002-08-20
  • 打赏
  • 举报
回复
<%%>这是服务端脚本标记.
看清楚了!!!???
yonghengdizhen 2002-08-20
  • 打赏
  • 举报
回复
<%
set mtstest=server.createobject("line.ClineCtrl")
mtstest.ondrow
set mtstest=nothing
%>
你把线画到了服务器上.
它能不报错吗??

画给谁看呀?
zheng_hz 2002-08-20
  • 打赏
  • 举报
回复
脚本语言调用要使用双接口。
xjbx 2002-08-20
  • 打赏
  • 举报
回复
如果你的ocx没写错的话,就是权限的问题了!
你在ie安全设置中,把对“active x 插件和控件”的第2项(未标记安全...)的选项设置为“启用”

28,408

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧