Jump to content

HTMLayout with COM Object


Recommended Posts

Hi all.

I have a problem using the COM Object HTMLayout with witch I can execute HTM code in a GUI.

I succeed to register the DLL AxHTMLayout for use the object AxHTMLayout.Engine.1.

I use Windows 7, so I used the command :

\windows\syswow64\regsvr32 C:\..\AxHTMLayout.dll

RegSVR32 return the success message.

So I use for the first try :

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Const $BE_BUTTON_CLICK = 0
Const $BE_BUTTON_PRESS = 1
Const $BE_BUTTON_STATE_CHANGED = 2
Const $BE_EDIT_VALUE_CHANGING = 3
Const $BE_EDIT_VALUE_CHANGED = 4
Const $BE_SELECT_SELECTION_CHANGED = 5
Const $BE_SELECT_STATE_CHANGED = 6
Const $BE_POPUP_REQUEST = 7
Const $BE_POPUP_READY = 8
Const $BE_POPUP_DISMISSED = 9
Const $BE_MENU_ITEM_ACTIVE = 10
Const $BE_MENU_ITEM_CLICK = 11
Const $BE_CONTEXT_MENU_SETUP = 15
Const $BE_CONTEXT_MENU_REQUEST = 16
Const $BE_VISIUAL_STATUS_CHANGED = 17
Const $BE_HYPERLINK_CLICK = 128
Const $BE_TABLE_HEADER_CLICK = $BE_HYPERLINK_CLICK + 1 ;129
Const $BE_TABLE_ROW_CLICK = $BE_TABLE_HEADER_CLICK + 1 ;130
Const $BE_TABLE_ROW_DBL_CLICK = $BE_TABLE_ROW_CLICK + 1 ;131
Const $BE_ELEMENT_COLLAPSED = 144
Const $BE_ELEMENT_EXPANDED = $BE_ELEMENT_COLLAPSED + 1 ;145
Const $BE_ACTIVATE_CHILD = $BE_ELEMENT_EXPANDED + 1 ;146
Const $BE_DO_SWITCH_TAB = $BE_ACTIVATE_CHILD ;146
Const $BE_INIT_DATA_VIEW = $BE_DO_SWITCH_TAB + 1 ;147
Const $BE_ROWS_DATA_REQUEST = $BE_INIT_DATA_VIEW + 1 ;148
Const $BE_UI_STATE_CHANGED = $BE_ROWS_DATA_REQUEST + 1 ;149
Const $BE_FORM_SUBMIT = $BE_UI_STATE_CHANGED + 1 ;150
Const $BE_FORM_RESET = $BE_FORM_SUBMIT + 1 ;151
Const $BE_DOCUMENT_COMPLETE = $BE_FORM_RESET + 1 ;152
Const $BE_HISTORY_PUSH = $BE_DOCUMENT_COMPLETE + 1 ;153
Const $BE_HISTORY_DROP = $BE_HISTORY_PUSH + 1 ;154
Const $BE_HISTORY_PRIOR = $BE_HISTORY_DROP + 1 ;155
Const $BE_HISTORY_NEXT = $BE_HISTORY_PRIOR + 1 ;156
Const $BE_HISTORY_STATE_CHANGED = $BE_HISTORY_NEXT + 1 ;157
Const $BE_FIRST_APPLICATION_EVENT_CODE = 256


$Form1 = GUICreate("Form1", 800, 550, 10, 50, $WS_POPUP, $WS_EX_LAYERED)
$size = WinGetClientSize($Form1)
GUISetBkColor(0xABCDEF)
$Obj1 = ObjCreate("AxHTMLayout.Engine.1")
$Obj1_ctrl = GUICtrlCreateObj($Obj1, 0, 0, $size[0], $size[1])
$Oevent = ObjEvent($Obj1, "event_")
_WinAPI_SetLayeredWindowAttributes($Form1, 0xABCDEF, 250)
GUISetState(@SW_SHOW)
$Obj1.Load('file://' &amp; @ScriptDir &amp; '\sliding-list.htm')

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $GUI_EVENT_SECONDARYUP
                        Exit
        EndSwitch
WEnd

Func event_onControlEvent($element, $eventtype, $reason, $handled)
        ConsoleWrite($eventtype &amp; @CRLF)
        If $eventtype = $BE_HYPERLINK_CLICK Then
                If $element.attribute("id") = "CloseGui" Then Exit
        EndIf
        If $eventtype = $BE_BUTTON_CLICK Then
                If $element.attribute("id") = "buttonclick" Then MsgBox("", "Button Test", "Button Click Event")
        EndIf
        If $eventtype = $BE_ELEMENT_COLLAPSED Then
                ConsoleWrite('Collapsed: ' &amp; $element.attribute("id") &amp; @CRLF)
        EndIf
        If $eventtype = $BE_ELEMENT_EXPANDED Then
                ConsoleWrite('Expanded: ' &amp; $element.attribute("id") &amp; @CRLF)
        EndIf

EndFunc   ;==>event_onControlEvent

Func event_DocumentLoaded()
        $O2event = ObjEvent($Obj1.root, "event_", "_IElementEvents")
EndFunc   ;==>event_DocumentLoaded

And i have the error for an inexistant COM object.

I try IsObj with $Obj1 var, and it tells me that the object is inexistant.

I do not find the name of OLE object corresponding to the DLL AxHTMLayout, because I'm sure that the DLL installation succeed.

Thank you (and sorry for English error, I'm French.).

Link to comment
Share on other sites

I see that you are on a x64 OS, presumably you are using a x86 dll, so are you running x86 AutoIt?

Set:

#AutoIt3Wrapper_UseX64=n

And don't forget to install SciTE4AutoIt3 if you haven't already.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...