Internet Explorer's ClientToWindow Method

This forum is meant for requesting technical support or reporting bugs.

Moderators: Vengeance66, time-killer-games, Harvester, GM-Support, Lyberodoggy, Candle, Mystery, ShadowHunter, reneuend

Internet Explorer's ClientToWindow Method

Postby time-killer-games » Fri Jan 12, 2018 10:52 pm

I'm writing a plugin for Adventure Maker that allows you to execute VBScript files without the restriction of not being able to use CreateObject. The reason I'm doing this is because for some odd reason, CreateObject is normally blocked from being used in AM. It's a very useful and powerful feature of VBS that I feel many could benefit from, so I'm adding it in.

This is an example script file I'd like to use to be shipped with the plugin, which is an Internet Explorer object:

Code: Select all
Set Screen = CreateObject("InternetExplorer.Application")
Screen.FullScreen = True
Screen.TheaterMode = True
ScreenWidth = Screen.Width
ScreenHeight = Screen.Height
Screen.Quit

Set objShell = CreateObject("Wscript.Shell")
Set IE = CreateObject("InternetExplorer.Application")

Sub CheckIt

    If IE.document.parentWindow.event.keycode = 27 Then bEsc = True

End Sub

With IE

    .FullScreen = False
    .TheaterMode = False
    .MenuBar = False
    .StatusBar = False
    .ToolBar = False
    .Resizable = False
    .Width = 640
    .Height = 480
    .ClientToWindow .Width, .Height
    .Left = (ScreenWidth / 2) - (.Width / 2)
    .Top = (ScreenHeight / 2) - (.Height / 2)
    .Navigate "http://www.yoyogames.com/"
    .Visible = True

    Set Processes = GetObject("winmgmts:").InstancesOf("Win32_Process")

    intProcessId = ""

    For Each Process In Processes
   
        If StrComp(Process.Name, "iexplore.exe", vbTextCompare) = 0 Then
       
            intProcessId = Process.ProcessId
            Exit For
   
        End If

    Next

    If Len(intProcessId) > 0 Then
   
        objShell.AppActivate intProcessId

    End If

    If .FullScreen = True Or .TheaterMode = True Then

        Do While bEsc = False And (err.number = 0)

            Do While .Busy

                Dim dteWait
                dteWait = DateAdd("s", 0.000001, Now())

                Do Until (Now() > dteWait)
                Loop

            Loop

            Set .document.body.onkeypress = GetRef("CheckIt")

            For i = 1 To 100

                If (err.number <> 0) Or bEsc Then Exit Do

            Next

        Loop

        .Visible = False
        .Quit

    End If

End With


However, the ClientToWindow method doesn't appear to be working. It's supposed to convert the client area, (not including the window border), to equal 640x480, but it doesn't seem to be doing that, or anything, for that matter. The entire window, (including the border), is 640x480, so it's not the right size.

Anyone with experience in regular VBScript know what I'm doing wrong or how to solve this?

Thanks!
Samuel
User avatar
time-killer-games
Expert Member
 
Posts: 382
Joined: Fri Dec 24, 2010 6:10 pm
Location: Virginia Beach, VA

Re: Internet Explorer's ClientToWindow Method

Postby reneuend » Sat Jan 13, 2018 2:02 pm

I used to be well-versed in VB Script, but it has been 10 years since I last used it on a daily basis.

I didn't see anything that stuck out as odd in your code. The version of IE might make a difference.
Have you thought about using vb6 and building a form that runs the webbrowser object in it?
Would this provide the same benefit you are looking for?
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2651
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Re: Internet Explorer's ClientToWindow Method

Postby time-killer-games » Sun Jan 14, 2018 6:12 pm

That wouldn't exactly achieve what I'm looking for. This would be just an example script that would come with the plugin. The point of the plugin is to enable usage of the CreateObject() function, which can do a whole lot of things other than just creating an internet browser. Thanks for the comment and suggestions though. :)
User avatar
time-killer-games
Expert Member
 
Posts: 382
Joined: Fri Dec 24, 2010 6:10 pm
Location: Virginia Beach, VA


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 1 guest

cron