How to create object from .dll file? (more specific = WTSAPI32.DLL) 
Author Message
 How to create object from .dll file? (more specific = WTSAPI32.DLL)

Hi,

I'm trying to create a VBScript that retrieves the IP-
address of a user connecting through Terminal Services.

It can be done using the WTSQuerySessionInformation from
the WTSAPI32.DLL (see
http://www.*-*-*.com/
us/termserv/termserv/wtsquerysessioninformation.asp?
frame=true) but I don't know how to create the .dll as an
object using CreateObjetct or GetObject...

On the server the wtsapi32.dll file is located in
c:\winnt\system32 and I tried searching the registry
for "wtsapi32" but nothing was found, so I don't know it
it is registered. I tried to register it with "regsvr32
c:\winnt\system32\wtsapi32.dll" but got the error:
"c:\winnt\system32\wtsapi32.dll was loaded, but the
DllRegisterServer entry point was not found."

I tried this in VBscript:

Dim oWTS
Set oWTS = GetObject("C:\\WINNT\\system32\\wtsapi32.dll")

But it didn't work...

Can anybody help? Any help will be HIGHLY appreciated...

If someone respond please CC: me at the address

Thanks!!!

All the best,
Nicolaj



Sat, 25 Jun 2005 19:50:22 GMT  
 How to create object from .dll file? (more specific = WTSAPI32.DLL)
You have to know the ProgID or GUID to instantiate a DLL through CreateObject() such as:

    CreateObject("ADODB.Recordset")
    CreateObject("72C5CE5F-749B-4299-9B84-AB4C2EB3EF47")

However this will only allow you to see the (default?) interface.

Since VBScript is not strongly typed it is *very* unlikely that you would ever succeed in calling into this DLL anyway
unless it was written specifically to be called from script.

You would be best to wrap an API call or proper COM object call (if you can find the COM object model that corresponds
to this DLL) into your own DLL (Visual Basic for example) and call that from script. This would allow you to define your
function parameters as Variant and Object in order to allow script to call and retrieve return value from the DLL.

The page you are referring to is C++ documentation for the windows API calls that can be made.

    Redistributable: Requires Terminal Server 4.0 SP4 on Windows NT 4.0 SP4.
    Unicode: Implemented as Unicode and ANSI versions.
    Header: Declared in Wtsapi32.h.
    Library: Use Wtsapi32.lib.

You should be able to make those calls from VB (easiest method of creating a DLL I reckon) with a little help (not me
I'm afraid - my experience of API is using them by rote from Dan Applemans VB API book).
Unfortunately API is way out of the question from script - it's just not doable.

Hope this helps.

Chris Barber.

Hi,

I'm trying to create a VBscript that retrieves the IP-
address of a user connecting through Terminal Services.

It can be done using the WTSQuerySessionInformation from
the WTSAPI32.DLL (see
http://msdn.microsoft.com/library/en-
us/termserv/termserv/wtsquerysessioninformation.asp?
frame=true) but I don't know how to create the .dll as an
object using CreateObjetct or GetObject...

On the server the wtsapi32.dll file is located in
c:\winnt\system32 and I tried searching the registry
for "wtsapi32" but nothing was found, so I don't know it
it is registered. I tried to register it with "regsvr32
c:\winnt\system32\wtsapi32.dll" but got the error:
"c:\winnt\system32\wtsapi32.dll was loaded, but the
DllRegisterServer entry point was not found."

I tried this in VBscript:

Dim oWTS
Set oWTS = GetObject("C:\\WINNT\\system32\\wtsapi32.dll")

But it didn't work...

Can anybody help? Any help will be HIGHLY appreciated...

If someone respond please CC: me at the address

Thanks!!!

All the best,
Nicolaj



Sat, 25 Jun 2005 20:35:29 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. wtsapi32.dll

2. DLL DLL DLL DLL DLL DLL

3. Creating an Object without registering the DLL

4. Problems building install file - AutPrx32.dll, AutMgr32.dll, RACMGR32.dll, CLIREG32.exe NOT FOUND

5. Force VB to Use a specific .DLL-file?

6. Force VB to use a specific .DLL-file?

7. Creating GIF files from GhostScript Dll

8. Does file system object or scrrun.dll come in windows by default

9. Which OCX/DLL-file keeps the WScript Object?

10. How to Access an Object in a VC++ Dll from a Script File

11. Check DLL-File (Exist DLL-File?)

12. Creating DLL files for bmp files

 

 
Powered by phpBB® Forum Software