This project has moved and is read-only. For the latest updates, please go here.

MsgBox and InputBox error in VBScript

Mar 24 at 10:31 AM
Hi,
I'm trying to use ClearScript to run a bunch of legacy VBScript's.

However, im getting a "Permission Denied 0x800a0046" error when I call MsgBox or InputBox.

Do I need to set up the engine in a special way or ? sorry i'm a total ClearScript newbie.

Regards Jesper Sandgaard
Mar 24 at 12:39 PM
Hi Jesper,

For these functions to work, you must provide an implementation of Microsoft.ClearScript.Windows.IHostWindow. Here's a minimal example:
internal class HostWindow : IHostWindow {
    public IntPtr OwnerHandle {
        get { return IntPtr.Zero; }
    }
    public void EnableModeless(bool enable) {
        throw new NotImplementedException();
    }
}
And then:
engine.HostWindow = new HostWindow();
engine.Execute("result = MsgBox(\"Ready?\", vbQuestion + vbYesNo, \"Let's Go!\")");
You can download ClearScript's API reference here.

Good luck!
Mar 28 at 8:48 AM
Thanks ! Now it's working.

Regards Jesper Sandgaard