You are not logged in.

#1 24 Mar 2010 23:33

Phillip Geurtz
Member
Registered: 11 Mar 2010
Posts: 3

VBscript & Windows API

I can't seem to get this to return anything other than 0

Dim wshShell, errRun : Set wshShell = WScript.CreateObject("WScript.Shell")
errRun = wshShell.Run("C:\WINDOWS\System32\RUNDLL32.EXE user32.dll IsClipboardFormatAvailable 1")
MsgBox errRun

According to http://msdn.microsoft.com/en-us/library … 85%29.aspx I would expect to get anything other than 0.

Any ideas? This works when invoking Vbscript in Office.

Offline

#2 26 Mar 2010 12:19

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: VBscript & Windows API

In VBScript don't think you can use RunDll32.exe to pass arguments to Windows API functions.

In other words your script effectively runs:

RUNDLL32.EXE user32.dll IsClipboardFormatAvailable <NULL>

which always returns 0

There may be some cases where you can workaround this issue by calling a function and passing a command line string, but in general I don't think its supported.

Offline

Board footer

Powered by