; _______________________________________________________________________________________
;|                                                                                       |
;| ..::FreshLib::..  Free, open source. Licensed under "BSD 2-clause" license."          |
;|_______________________________________________________________________________________|
;
;  Description: COM interfaces.
;
;  Target OS: Win32
;
;  Dependencies:
;
;  Notes:
;_________________________________________________________________________________________

; error codes
S_OK = 0
S_FALSE = 1
E_NOTIMPL      = $80004001 ; Not implemented
E_NOINTERFACE  = $80004002 ; No such interface supported
E_ABORT        = $80004004 ; Operation aborted
E_ACCESSDENIED = $80070005 ; General access denied error
E_FAIL         = $80004005 ; Unspecified failure
E_HANDLE       = $80070006 ; Handle that is not valid
E_INVALIDARG   = $80070057 ; One or more arguments are not valid
E_OUTOFMEMORY  = $8007000E ; Failed to allocate necessary memory
E_POINTER      = $80004003 ; Pointer that is not valid
E_UNEXPECTED   = $8000FFFF ; Unexpected failure

OLECLOSE_SAVEIFDIRTY = 0
OLECLOSE_NOSAVE      = 1
OLECLOSE_PROMPTSAVE  = 2

CLSCTX_INPROC_SERVER = 1
CLSCTX_INPROC_HANDLER = 2
CLSCTX_INPROC = CLSCTX_INPROC_SERVER or CLSCTX_INPROC_HANDLER

OLEIVERB_SHOW             = -1
OLEIVERB_OPEN             = -2
OLEIVERB_HIDE             = -3
OLEIVERB_UIACTIVATE       = -4
OLEIVERB_INPLACEACTIVATE  = -5
OLEIVERB_DISCARDUNDOSTATE = -6

; VARIANT TYPE

VT_EMPTY             = 0
VT_NULL              = 1
VT_I2                = 2
VT_I4                = 3
VT_R4                = 4
VT_R8                = 5
VT_CY                = 6
VT_DATE              = 7
VT_BSTR              = 8
VT_DISPATCH          = 9
VT_ERROR             = 10
VT_BOOL              = 11
VT_VARIANT           = 12
VT_UNKNOWN           = 13
VT_DECIMAL           = 14
VT_I1                = 16
VT_UI1               = 17
VT_UI2               = 18
VT_UI4               = 19
VT_I8                = 20
VT_UI8               = 21
VT_INT               = 22
VT_UINT              = 23
VT_VOID              = 24
VT_HRESULT           = 25
VT_PTR               = 26
VT_SAFEARRAY         = 27
VT_CARRAY            = 28
VT_USERDEFINED       = 29
VT_LPSTR             = 30
VT_LPWSTR            = 31
VT_RECORD            = 36
VT_INT_PTR           = 37
VT_UINT_PTR          = 38
VT_FILETIME          = 64
VT_BLOB              = 65
VT_STREAM            = 66
VT_STORAGE           = 67
VT_STREAMED_OBJECT   = 68
VT_STORED_OBJECT     = 69
VT_BLOB_OBJECT       = 70
VT_CF                = 71
VT_CLSID             = 72
VT_VERSIONED_STREAM  = 73
VT_BSTR_BLOB         = $fff
VT_VECTOR            = $1000
VT_ARRAY             = $2000
VT_BYREF             = $4000


struct VARIANT
  .vType        dw ?
  .res_zero     rb 6
  .Data0        dd ?
  .Data1        dd ?
ends




com_interface IWebBrowser2, \
        QueryInterface,\
        AddRef,\
        Release,\
\
        GetTypeInfoCount, \
        GetTypeInfo, \
        GetIDsOfNames, \
        xInvoke, \
        GoBack, \
        GoForward, \
        GoHome, \
        GoSearch, \
        Navigate, \
        Refresh, \
        Refresh2, \
        Stop, \
        get_Application, \
        get_Parent, \
        get_Container, \
        get_Document, \
        get_TopLevelContainer, \
        get_Type, \
        get_Left, \
        put_Left, \
        get_Top, \
        put_Top, \
        get_Width, \
        put_Width, \
        get_Height, \
        put_Height, \
        get_LocationName, \
        get_LocationURL, \
        get_Busy, \
        Quit, \
        ClientToWindow, \
        PutProperty, \
        GetProperty, \
        get_Name, \
        get_HWND, \
        get_FullName, \
        get_Path, \
        get_Visible, \
        put_Visible, \
        get_StatusBar, \
        put_StatusBar, \
        get_StatusText, \
        put_StatusText, \
        get_ToolBar, \
        put_ToolBar, \
        get_MenuBar, \
        put_MenuBar, \
        get_FullScreen, \
        put_FullScreen, \
        Navigate2, \
        QueryStatusWB, \
        ExecWB, \
        ShowBrowserBar, \
        get_ReadyState, \
        get_Offline, \
        put_Offline, \
        get_Silent, \
        put_Silent, \
        get_RegisterAsBrowser, \
        put_RegisterAsBrowser, \
        get_RegisterAsDropTarget, \
        put_RegisterAsDropTarget, \
        get_TheaterMode, \
        put_TheaterMode, \
        get_AddressBar, \
        put_AddressBar, \
        get_Resizable, \
        put_Resizable



; IWebBrowser2 ready states:

READYSTATE_UNINITIALIZED = 0
READYSTATE_LOADING = 1
READYSTATE_LOADED = 2
READYSTATE_INTERACTIVE = 3
READYSTATE_COMPLETE = 4



com_interface IOleObject, \
        QueryInterface, \
        AddRef, \
        Release, \
\
        SetClientSite, \
        GetClientSite, \
        SetHostNames, \
        Close, \
        SetMoniker, \
        GetMoniker, \
        InitFromData, \
        GetClipboardData, \
        DoVerb, \
        EnumVerbs, \
        Update, \
        IsUpToDate, \
        GetUserClassID, \
        GetUserType, \
        SetExtent, \
        GetExtent, \
        Advise, \
        Unadvise, \
        EnumAdvise, \
        GetMiscStatus, \
        SetColorScheme


struct OLEINPLACEFRAMEINFO
  .cb            dd ?
  .fMDIApp       dd ?
  .hwndFrame     dd ?
  .haccel        dd ?
  .cAccelEntries dd ?
ends



com_interface IOleInPlaceObject,        \
        QueryInterface,                 \
        AddRef,                         \
        Release,                        \
\
        GetWindow,                      \
        ContextSensitiveHelp,           \
        InPlaceDeactivate,              \
        UIDeactivate,                   \
        SetObjectRects,                 \
        ReactivateAndUndo



com_interface IHTMLDocument2,           \
        QueryInterface,                 \
        AddRef,                         \
        Release,                        \
\
        GetTypeInfoCount,               \
        GetTypeInfo,                    \
        GetIDsOfNames,                  \
        Invoke,                         \
\
        get_Script,                     \
\
        get_all,                        \
        get_body,                       \
        get_activeElement,              \
        get_images,                     \
        get_applets,                    \
        get_links,                      \
        get_forms,                      \
        get_anchors,                    \
        put_title,                      \
        get_title,                      \
        get_scripts,                    \
        put_designMode,                 \
        get_designMode,                 \
        get_selection,                  \
        get_readyState,                 \
        get_frames,                     \
        get_embeds,                     \
        get_plugins,                    \
        put_alinkColor,                 \
        get_alinkColor,                 \
        put_bgColor,                    \
        get_bgColor,                    \
        put_fgColor,                    \
        get_fgColor,                    \
        put_linkColor,                  \
        get_linkColor,                  \
        put_vlinkColor,                 \
        get_vlinkColor,                 \
        get_referrer,                   \
        get_location,                   \
        get_lastModified,               \
        put_URL,                        \
        get_URL,                        \
        put_domain,                     \
        get_domain,                     \
        put_cookie,                     \
        get_cookie,                     \
        put_expands,                    \
        get_expands,                    \
        put_charset,                    \
        get_charset,                    \
        put_defaultCharset,             \
        get_defaultCharset,             \
        get_mimeType,                   \
        get_fileSize,                   \
        get_fileCreatedDate,            \
        get_fileModifiedDate,           \
        get_fileUpdatedDate,            \
        get_security,                   \
        get_protocol,                   \
        get_nameProp,                   \
        write,                          \
        writeln,                        \
        open,                           \
        close,                          \
        clear,                          \
        queryCommandSupported,          \
        queryCommandEnabled,            \
        queryCommandState,              \
        queryCommandIndeterm,           \
        queryCommandText,               \
        queryCommandValue,              \
        execCommand,                    \
        execCommandShowHelp,            \
        createElement,                  \
        put_onhelp,                     \
        get_onhelp,                     \
        put_onclick,                    \
        get_onclick,                    \
        put_ondblclick,                 \
        get_ondblclick,                 \
        put_onkeyup,                    \
        get_onkeyup,                    \
        put_onkeydown,                  \
        get_onkeydown,                  \
        put_onkeypress,                 \
        get_onkeypress,                 \
        put_onmouseup,                  \
        get_onmouseup,                  \
        put_onmousedown,                \
        get_onmousedown,                \
        put_onmousemove,                \
        get_onmousemove,                \
        put_onmouseout,                 \
        get_onmouseout,                 \
        put_onmouseover,                \
        get_onmouseover,                \
        put_onreadystatechange,         \
        get_onreadystatechange,         \
        put_onafterupdate,              \
        get_onafterupdate,              \
        put_onrowexit,                  \
        get_onrowexit,                  \
        put_onrowenter,                 \
        get_onrowenter,                 \
        put_ondragstart,                \
        get_ondragstart,                \
        put_onselectstart,              \
        get_onselectstart,              \
        elementFromPoint,               \
        get_parentWindow,               \
        get_styleSheets,                \
        put_onbeforeupdate,             \
        get_onbeforeupdate,             \
        put_onerrorupdate,              \
        get_onerrorupdate,              \
        toString,                       \
        createStyleSheet



struct SAFEARRAYBOUND
  .cElements    dd  ?
  .lLbound      dd  ?
ends


struct SAFEARRAY
  .fFeatures  dw ?
  .cbElements dd ?
  .cLocks     dd ?
  .pvData     dd ?
  .rgsabound0 SAFEARRAYBOUND
  .rgsabound1 SAFEARRAYBOUND
ends




com_interface IDispatch,              \
        QueryInterface,               \
        AddRef,                       \
        Release,                      \
\
        .GetTypeInfoCount,            \
        .GetTypeInfo,                 \
        .GetIDsOfNames,               \
        .Invoke


com_interface IClassFactory,          \
        QueryInterface,               \
        AddRef,                       \
        Release,                      \
\
        CreateInstance,               \
        LockServer


;com_interface IHTMLElement,           \
;        QueryInterface,               \
;        AddRef,                       \
;        Release,                      \
;\

