有关smi文件的实现

unrknight 2003-05-07 04:00:01
1。怎样做类似realplayer的smi文件的效果。在浏览器上点击这个文件,直接调用我自己编写的程序。

2。服务器上运行asp页面,怎么样根据不同的访问动态的生成这个smi文件


各位大侠帮帮忙啊
...全文
105 点赞 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
unrknight 2003-05-08
自己顶
回复
unrknight 2003-05-07
不会吧,我就是不想用activex才这样做的啊◎◎◎◎

谁能帮我??
回复
fishzone 2003-05-07
这样的话。你可以做成客户端的ActiveX 空间。
把这个控件放在网页上,具体怎样实现,我也没有做过。
回复
unrknight 2003-05-07
fishzone(阿愚) :你这样做的话,虽然可以打开这个文件,但是如果我在ie中直接打开的话,他会出现有下载对话框,我关键是实现的这个功能就是不要有这个下载对话框,直接打开我的程序。就像realplayer调用smi文件一样,不知道怎么实现。
回复
unrknight 2003-05-07
fishzone(阿愚) :
回复
fishzone 2003-05-07
'打开文件关联的例子

Const ERROR_SUCCESS = 0&
Const REG_SZ = 1
Const HKEY_CLASSES_ROOT = &H80000000
Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpszValueName As String, ByVal dwReserved As Long, lpdwType As Long, lpbData As Any, cbData As Long) As Long
Declare Function RegOpenKey Lib "advapi32" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpszSubKey As String, phkResult As Long) As Long
Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long

Public Function RegSetStringValue(ByVal hKey As Long, ByVal strValueName As String, _
ByVal strData As String, Optional ByVal fLog) As Boolean
Dim lResult As Long
On Error GoTo 0
lResult = RegSetValueEx(hKey, strValueName, 0&, REG_SZ, ByVal strData, _
LenB(StrConv(strData, vbFromUnicode)) + 1)
If lResult = 0 Then
RegSetStringValue = True
Else
RegSetStringValue = False
End If
End Function

Public Function StripTerminator(ByVal strString As String) As String
Dim intZeroPos As Integer
intZeroPos = InStr(strString, Chr$(0))
If intZeroPos > 0 Then
StripTerminator = Left$(strString, intZeroPos - 1)
Else
StripTerminator = strString
End If
End Function

Public Sub SetFileType(ByVal strFileType As String, ExePathFile As String)
Dim Length As Integer

Dim KeyId As Long
Call RegCreateKey(HKEY_CLASSES_ROOT, "." & strFileType, KeyId)
Call RegSetValueEx(KeyId, "", 0&, REG_SZ, ByVal strFileType & "file", Len(strFileType & "file") + 1)
Dim KeyId1 As Long
Call RegCreateKey(HKEY_CLASSES_ROOT, strFileType & "file", KeyId1)
Call RegSetValueEx(KeyId1, "", 0&, REG_SZ, ByVal strFileType & "类型", LenB(strFileType & "类型") + 1)
Dim KeyId2 As Long
Call RegCreateKey(KeyId1, "DefaultIcon", KeyId2)
Call RegSetValueEx(KeyId2, "", 0&, REG_SZ, ByVal ExePathFile & ",0", Len(ExePathFile & ",0") + 1)
Dim KeyId3 As Long
Call RegCreateKey(KeyId1, "Shell", KeyId3)
Dim KeyId4 As Long
Call RegCreateKey(KeyId3, "Open", KeyId4)
Dim KeyId5 As Long
Call RegCreateKey(KeyId4, "command", KeyId5)
Call RegSetValueEx(KeyId5, "", 0&, REG_SZ, ByVal ExePathFile & " %1", Len(ExePathFile & " %1") + 1)
'MsgBox "创建自定义类型后缀名成功。", vbInformation, "系统提示"
End Sub

用法:
Call SetFileType("csp", strEXEPathFile)
“csp”是文件后缀名。
strEXEPathFile 是打开这个后缀名的 Exe 文件完整路径。

双击时,在 From_Load 事件中,用 command 参数可以得到被打开文件的绝对路径。
回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7493

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2003-05-07 04:00
社区公告
暂无公告