标题:[求助]源码改DLL或者OCX要如何做?
只看楼主
redcar
Rank: 2
等 级:论坛游民
帖 子:210
专家分:60
注 册:2006-9-13
结帖率:100%
 问题点数:0 回复次数:5 
[求助]源码改DLL或者OCX要如何做?

以下这段源码,我想改成DLL或者OCX要如何做?这样可以在其他语言中当作1个控件来使用,比较方便啊
里面那个 MSComLED是串口通讯控件,VB6自带的,也可以用vs2005里面那个串口通讯控件替代

Function CALL_LED(ledstring As String) As String
Dim zw(1 To 32) As Byte
Dim zc(1 To 32) As Byte
Dim zimo As Integer
For I = 1 To Len(ledstring) Step 1
If Asc(Mid$(ledstring, I, 1)) < 0 Then
'写入的是汉字
If zimo = 1 Then MSComLED.Output = zc: zimo = 0
AA = Hex(Asc(Mid(ledstring, I, 1)))
bb = (94 * (CLng("&H" & Mid(AA, 1, 2)) - &HA1) + (CLng("&H" & Mid(AA, 3, 2)) - &HA1)) * 32 + 1
HzFile = App.Path + "\" + "hzk16"
Open HzFile For Binary Access Read As #1 '读取该汉字在16*16点阵字库中的原始字模
Get #1, bb, zw
Close #1
MSComLED.Output = zw
Else
'写入的不是汉字
If zimo = 0 Then
AA = Hex(Asc(Mid(ledstring, I, 1)))
bb = (CLng("&H" & Mid(AA, 1, 2))) * 16 + 1
HzFile = App.Path + "\" + "ASC16"
Open HzFile For Binary Access Read As #2 '读取该汉字在8*16点阵字库中的原始字模
Get #2, bb, zw
Close #2
zc(1) = zw(1): zc(3) = zw(2): zc(5) = zw(3): zc(7) = zw(4): zc(9) = zw(5): zc(11) = zw(6)
zc(13) = zw(7): zc(15) = zw(8): zc(17) = zw(9): zc(19) = zw(10): zc(21) = zw(11): zc(23) = zw(12)
zc(25) = zw(13): zc(27) = zw(14): zc(29) = zw(15): zc(31) = zw(16): zimo = 1
zc(2) = 0: zc(4) = 0: zc(6) = 0: zc(8) = 0: zc(10) = 0: zc(12) = 0: zc(14) = 0: zc(16) = 0
zc(18) = 0: zc(20) = 0: zc(22) = 0: zc(24) = 0: zc(26) = 0: zc(28) = 0: zc(30) = 0: zc(32) = 0
Else
AA = Hex(Asc(Mid(ledstring, I, 1)))
bb = (CLng("&H" & Mid(AA, 1, 2))) * 16 + 1
HzFile = App.Path + "\" + "ASC16"
Open HzFile For Binary Access Read As #3 '读取该汉字在8*16点阵字库中的原始字模
Get #3, bb, zw
Close #3
zc(2) = zw(1): zc(4) = zw(2): zc(6) = zw(3): zc(8) = zw(4): zc(10) = zw(5): zc(12) = zw(6)
zc(14) = zw(7): zc(16) = zw(8): zc(18) = zw(9): zc(20) = zw(10): zc(22) = zw(11): zc(24) = zw(12)
zc(26) = zw(13): zc(28) = zw(14): zc(30) = zw(15): zc(32) = zw(16): zimo = 0

MSComLED.Output = zc
End If
End If
Next
If zimo = 1 Then MSComLED.Output = zc: zimo = 0
End Function

搜索更多相关主题的帖子: OCX 源码 DLL 
2006-11-25 10:06
sansizhou
Rank: 1
等 级:新手上路
帖 子:47
专家分:0
注 册:2006-11-24
得分:0 

感觉只能是activeX dll。通用的可能比较难哦!

2006-11-27 15:59
flyly
Rank: 1
等 级:新手上路
帖 子:254
专家分:0
注 册:2006-11-13
得分:0 
簡單!

2006-11-27 16:01
redcar
Rank: 2
等 级:论坛游民
帖 子:210
专家分:60
注 册:2006-9-13
得分:0 
我就要activeX dll就可以了,只要可以导入到其他语言的控件里面就可以了,楼上兄弟,麻烦你弄弄好吗?
2006-11-28 13:00
redcar
Rank: 2
等 级:论坛游民
帖 子:210
专家分:60
注 册:2006-9-13
得分:0 
就想做这个函数
Function CALL_LED(ledstring As String) As String
能够在做成控件
2006-11-29 10:19
redcar
Rank: 2
等 级:论坛游民
帖 子:210
专家分:60
注 册:2006-9-13
得分:0 
If zimo = 1 Then MSComLED.Output = zc: zimo = 0
这句里面,冒号 :
是什么意思啊?
2006-11-29 10:24



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-105223-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020188 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved