Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

DLL aus ActiveX-Control

Empfohlene Antworten

Veröffentlicht

Hallo Comm.,

leider ist es ja nicht möglich Funktionen aus DLL-Dateien zu deklarieren.

Ich habe aber gelesen, dass es möglich ist sich ein ActiveX-Control zu schreiben, dort die DLL-Funktion zu deklarieren und dann von vbscript aus diese Funktion aus dem activeX-Control aufzurufen. kann mir vllt. jmd. ein Beispiel posten wie man Funktionen aus einem "nonvisible activeX-Control" aufruft?

(das control dann zu schreiben dürfte ja kein Problem sein.)

mfg

Hi,

habs jetzt übers Wochenende rausgefunden... im nachhinein ganz einfach :D

Für alle die mal sowas suchen:

1. COM Klasse erstellen, z.B.

<ComClass(MyTestClass.ClassId, MyTestClass.InterfaceId, MyTestClass.EventsId)> _

Public Class MyTestClass


#Region "COM-GUIDs"

    Public Const ClassId As String = "0d3d0928-b502-4eec-bd34-0aeae9044116"

    Public Const InterfaceId As String = "5eb12215-d9d1-4816-8460-f993ef9bc7b9"

    Public Const EventsId As String = "0319b2d6-2149-4e19-a3ad-f3de40e7184f"

#End Region


#Region "Dll-Funktionen"

    Private Declare Function Beep Lib "kernel32.dll" ( _

        ByVal dwFreq As Long, _

        ByVal dwDuration As Long) As Long

#End Region


    Public Sub New()

        MyBase.New()

    End Sub




    Public Function MyBeep(Optional ByVal freq As Long = 440, Optional ByVal duration As Long = 1000)

        Beep(freq, duration)

        Return Nothing

    End Function


    Public Function multipliziere(ByVal zahl1 As Integer, ByVal zahl2 As Integer) As Long

        multipliziere = zahl1 * zahl2

    End Function


End Class
2. Project builden. 3. dll - registrieren, mit RegAsm.exe
C:\WINDOWS\Microsoft.NET\Framework\v2.x.x>RegAsm.exe "[Pfad]"
4. Aufruf in vbScript:
Set obj = CreateObject("MyActiveXControl.MyTestClass")

obj.MyBeep

MsgBox obj.multipliziere(13, 37)

Set obj = Nothing

Nur noch als Hinweis, der Name ActiveX-Control ist hier eigtl. falsch - wie ich mittlerweile weiß - wenn überhaupt handelt es sich um eine ActiveX - DLL.

Gruß

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.