I created a new dll class using vb.net 2010.
It has two functions:
I want to use the functions from a vbscript (vb) file from a program, so i execute the vb file to find a window. But I cant get it to work:Code:Option Explicit On Imports System Public Class MYDLL Private Declare Function FxFindWindow Lib "user32" Alias "FindWindowA" _ (ByVal szClassName As String, ByVal szWindow As String) As Long Private Declare Function FxSendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam _ As Long, ByVal lParam As Long) As Long Private Const WM_CLOSE = &H10 Public Function FindWindow(ByVal CaptionString As String) As Long FindWindow = FxFindWindow(vbNullString, CaptionString) End Function Public Function KillWindow(ByVal winHandle As Long) As Long KillWindow = FxSendMessage(winHandle, WM_CLOSE, 0, 0) End Function End Class
The dll is called MYDLL.DLL
but it says:Code:Dim DataBin Set obj = CreateObject("MYDLL.MYDLL") DataBin = obj.FindWindow("txt - Notepad.exe") Dim filesys, filetxt, getname, path Set filesys = CreateObject("Scripting.FileSystemObject") Set filetxt = filesys.CreateTextFile("C:\output.txt", True) filetxt.WriteLine(DataBin) filetxt.Close
ActiveX component cant create object 'MYDLL.MYDLL'
So how do I fix this up?
(Yes Im new to vbscript)


Reply With Quote
