Hej ElPrebsi
Her er et eksempel jeg håber du kan bruge.
Husk at brugere af sit site skal acceptere at downloade og acceptere at installere ocx'en
Her er html'en
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<form action="ocxtest.html" name="ocxform" id="ocxform" onSubmit="startnotepad()">
<body>
<object classid="clsid:0443956C-4798-4BB3-8DFF-6D2AB4501C17" name="notepadocx">
<SPAN STYLE="color:red">ActiveX control failed to load!
-- Please check browser security settings.</SPAN>
</object>
</body>
</html>
<input type="submit" name="Start" value="Start">
</form>
<script language="VBScript">
public sub startnotepad()
ocxform.notepadocx.notepad("calc.exe")
End Sub
</script>
'Og her er ocx'en
' følgende skal gemmes som akjnotepad.ctl
VERSION 5.00
Begin VB.UserControl Akjnotepad
ClientHeight = 2235
ClientLeft = 0
ClientTop = 0
ClientWidth = 2700
ScaleHeight = 2235
ScaleWidth = 2700
Begin VB.Frame Frame1
Caption = "Notepad ocx"
Height = 1950
Left = 135
TabIndex = 0
Top = 180
Width = 2400
End
End
Attribute VB_Name = "Akjnotepad"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Public Function notepad(ByVal path As String)
Dim ls_command, ls_dir, ls_args, ls_exe As String
ls_command = "open"
ls_dir = ""
ls_args = ""
ls_exe = path
ShellExecuteA 0, ls_command, ls_exe, ls_args, ls_dir, 5
End Function
' følgende skal gemmes i et modul der tilknyttes ocx'en
Attribute VB_Name = "Module1"
Option Explicit
Declare Function ShellExecuteA Lib "shell32.dll" ( _
ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
alternativt og nok lettere download VB projektet her:
http://www.swk-surf.dk/downloads/akj/akjnotepad.zip