i created the cls file:
Imports System Imports System.Runtime.InteropServices Imports Microsoft.Win32 Namespace WindowScriptingObject <Guid("7448E08D-ED0F-4E23-B528-91937BB41756"), _ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _ Public Interface _WindowScriptingObject <DispId(1)> Function ActiveWindow() As Integer <DispId(2)> Function WindowText(ByVal hWnd As Integer) As String End Interface <Guid("B146BF9E-78FC-4DB0-ABFE-9FF026B43E4D"), _ ClassInterface(ClassInterfaceType.None), _ ProgId("WindowScriptingObject")> Public Class WindowScriptingObject Implements _WindowScriptingObject Public WindowScriptingObject() Public Declare Auto Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow"() As Integer Public Declare Auto Function GetWindowText Lib "user32.dll" (ByVal hwnd As Int32, <Out()> ByVal lpString As System.Text.StringBuilder, ByVal cch As Int32) As Int32 Public Function ActiveWindow() As Integer Implements _WindowScriptingObject.ActiveWindow ActiveWindow=GetForegroundWindow() End Function Public Function WindowText(hwnd as Integer) As String Implements _WindowScriptingObject.WindowText on error resume next Dim b As New System.Text.StringBuilder(ChrW(0), 512) Dim ret = GetWindowText(hWnd, b, b.Capacity) WindowText = b.tostring End Function End Class End Namespace
and the bat file:
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe" /target:library /out:"%userprofile%\desktop\win32.dll" "%userprofile%\desktop\win32.cls" /verbose "C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm" /codebase "%userprofile%\desktop\win32.dll" /tlb:"%userprofile%\desktop\win32.tlb" /v If /i "%cmdcmdline:~0,6%"=="cmd /c" pause
after click on bat file the dll and tlb file was created.
heres the sample:
Set wso=CreateObject("WindowScriptingObject") x = wso.ActiveWindow msgbox x, , "vbs" msgbox wso.windowtext(x), , "vbs"
'the ActiveX component can't create a 'WindowScriptingObject' object'
so what i'm doing wrong?
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Private Sub btn_addline_Click(ByVal ...
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...