Jump to content

GMib

Active Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by GMib

  1. I've modified dll for supporting multiple channel. i added _GetChannelVolumeLevelScalar_Vista($channel) and _SetChannelVolumeLevelScalar_Vista($channel,$newVolume) where channel is 0 to 5 int ( 0:left, 1:right, 2:center, 3:sub, 4:behind left, 5:behind right on my soundcard) /**************************************************************************** * _GetChannelVolumeLevelScalar_Vista() * * Returns channel volume level as a scalar value from 0 to 100. ****************************************************************************/ AU3_PLUGIN_DEFINE(_GetChannelVolumeLevelScalar_Vista) { AU3_PLUGIN_VAR *pMyResult; float currentVolume = 0; int channel = 0; /* Allocate and build the return variable */ pMyResult = AU3_AllocVar(); AU3_SetInt32(pMyResult, -1); *n_AU3_ErrorCode = 1; /* Get channel */ channel = (int)AU3_GetInt32(&p_AU3_Params[0]); if (SUCCEEDED(endpointVolume->GetChannelVolumeLevelScalar(channel,&currentVolume))) { AU3_SetDouble(pMyResult, (double)(currentVolume * 100)); *n_AU3_ErrorCode = 0; } // Pass back the result, error code and extended code. *p_AU3_Result = pMyResult; *n_AU3_ExtCode = 0; return AU3_PLUGIN_OK; } /**************************************************************************** * _SetChannelVolumeLevelScalar_Vista() * * Sets channel volume level as a scalar value from 0 to 100. ****************************************************************************/ AU3_PLUGIN_DEFINE(_SetChannelVolumeLevelScalar_Vista) { AU3_PLUGIN_VAR *pMyResult; float newVolume = 0; int channel = 0; /* Allocate and build the return variable */ pMyResult = AU3_AllocVar(); AU3_SetInt32(pMyResult, -1); *n_AU3_ErrorCode = 1; /* Get passed volume and channel */ newVolume = (float)(AU3_GetDouble(&p_AU3_Params[1]) / 100); channel = (int)AU3_GetInt32(&p_AU3_Params[0]); if (SUCCEEDED(endpointVolume->SetChannelVolumeLevelScalar(channel,newVolume, NULL))) { AU3_SetInt32(pMyResult, 0); *n_AU3_ErrorCode = 0; } // Pass back the result, error code and extended code. *p_AU3_Result = pMyResult; *n_AU3_ExtCode = 0; return AU3_PLUGIN_OK; }
  2. I managed to make it work but only with a single argument. $a = DllStructCreate("UINT;UINT;UINT64") $result = DllCall($Sciterdll, "UINT", "ValueInit", "ptr", DllStructGetPtr($a) ) $result = DllCall($Sciterdll, "UINT", "ValueStringDataSet", "ptr", DllStructGetPtr($a),"wstr",'test',"UINT",4,"UINT",0 ) $result = DllCall($Sciterdll, "BOOL", "SciterCall", "HWND", $STHwnd, "str", "showValues", "UINT", 1, "ptr", DllStructGetPtr($a), "ptr*", "") i found ValueInit and ValueStringDataSet in Value.h : #ifndef __value_h__ #define __value_h__ #ifdef WIN32 #include <windows.h> #endif #if !defined(STATIC_LIB) #if defined(HTMLAYOUT_EXPORTS) || defined(SCITER_EXPORTS) #define VALAPI __declspec(dllexport) __stdcall #else #define VALAPI __declspec(dllimport) __stdcall #endif #else #define VALAPI #endif enum VALUE_RESULT { HV_OK_TRUE = -1, HV_OK = 0, HV_BAD_PARAMETER = 1, HV_INCOMPATIBLE_TYPE = 2 }; typedef struct { UINT t; UINT u; UINT64 d; } VALUE; #define FLOAT_VALUE double typedef const unsigned char* LPCBYTES; enum VALUE_TYPE { T_UNDEFINED = 0, T_NULL = 1, T_BOOL, T_INT, T_FLOAT, T_STRING, T_DATE, // INT64 - contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC), a.k.a. FILETIME on Windows T_CURRENCY, // INT64 - 14.4 fixed number. E.g. dollars = int64 / 10000; T_LENGTH, // length units, value is int or float, units are VALUE_UNIT_TYPE T_ARRAY, T_MAP, T_FUNCTION, T_BYTES, // sequence of bytes - e.g. image data T_OBJECT, // scripting object proxy (TISCRIPT/SCITER) T_DOM_OBJECT // DOM object (CSSS!), use get_object_data to get HELEMENT }; enum VALUE_UNIT_TYPE { UT_EM = 1, //height of the element's font. UT_EX = 2, //height of letter 'x' UT_PR = 3, //% UT_SP = 4, //%% "springs", a.k.a. flex units reserved1 = 5, reserved2 = 6, UT_PX = 7, //pixels UT_IN = 8, //inches (1 inch = 2.54 centimeters). UT_CM = 9, //centimeters. UT_MM = 10, //millimeters. UT_PT = 11, //points (1 point = 1/72 inches). UT_PC = 12, //picas (1 pica = 12 points). UT_DIP = 13, reserved3 = 14, UT_COLOR = 15, // color in int UT_URL = 16, // url in string UT_SYMBOL = 0xFFFF, // for T_STRINGs designates symbol string ( so called NAME_TOKEN - CSS or JS identifier ) }; enum VALUE_UNIT_TYPE_DATE { DT_HAS_DATE = 0x01, // date contains date portion DT_HAS_TIME = 0x02, // date contains time portion HH:MM DT_HAS_SECONDS = 0x04, // date contains time and seconds HH:MM:SS DT_UTC = 0x10, // T_DATE is known to be UTC. Otherwise it is local date/time }; // Sciter or TIScript specific enum VALUE_UNIT_TYPE_OBJECT { UT_OBJECT_ARRAY = 0, // type T_OBJECT of type Array UT_OBJECT_OBJECT = 1, // type T_OBJECT of type Object UT_OBJECT_CLASS = 2, // type T_OBJECT of type Type (class or namespace) UT_OBJECT_NATIVE = 3, // type T_OBJECT of native Type with data slot (LPVOID) UT_OBJECT_FUNCTION = 4, // type T_OBJECT of type Function UT_OBJECT_ERROR = 5, // type T_OBJECT of type Error }; /** * ValueInit - initialize VALUE storage * This call has to be made before passing VALUE* to any other functions */ EXTERN_C UINT VALAPI ValueInit( VALUE* pval ); /** * ValueClear - clears the VALUE and deallocates all assosiated structures that are not used anywhere else. */ EXTERN_C UINT VALAPI ValueClear( VALUE* pval ); /** * ValueCompare - compares two values, returns HV_OK_TRUE if val1 == val2. */ EXTERN_C UINT VALAPI ValueCompare( const VALUE* pval1, const VALUE* pval2 ); /** * ValueCopy - copies src VALUE to dst VALUE. dst VALUE must be in ValueInit state. */ EXTERN_C UINT VALAPI ValueCopy( VALUE* pdst, const VALUE* psrc ); /** * ValueIsolate - converts T_OBJECT value types to T_MAP or T_ARRAY. * use this method if you need to pass values between different threads. * The fanction is applicable for the Sciter */ EXTERN_C UINT VALAPI ValueIsolate( VALUE* pdst ); /** * ValueType - returns VALUE_TYPE and VALUE_UNIT_TYPE flags of the VALUE */ EXTERN_C UINT VALAPI ValueType( const VALUE* pval, UINT* pType, UINT* pUnits ); /** * ValueStringData - returns string data for T_STRING type * For T_FUNCTION returns name of the fuction. */ EXTERN_C UINT VALAPI ValueStringData( const VALUE* pval, LPCWSTR* pChars, UINT* pNumChars ); /** * ValueStringDataSet - sets VALUE to T_STRING type and copies chars/numChars to * internal refcounted buffer assosiated with the value. */ EXTERN_C UINT VALAPI ValueStringDataSet( VALUE* pval, LPCWSTR chars, UINT numChars, UINT units ); /** * ValueIntData - retreive integer data of T_INT, T_LENGTH and T_BOOL types */ EXTERN_C UINT VALAPI ValueIntData( const VALUE* pval, INT* pData ); /** * ValueIntDataSet - sets VALUE integer data of T_INT and T_BOOL types * Optionally sets units field too. */ EXTERN_C UINT VALAPI ValueIntDataSet( VALUE* pval, INT data, UINT type, UINT units ); /** * ValueInt64Data - retreive 64bit integer data of T_CURRENCY and T_DATE values. */ EXTERN_C UINT VALAPI ValueInt64Data( const VALUE* pval, INT64* pData ); /** * ValueInt64DataSet - sets 64bit integer data of T_CURRENCY and T_DATE values. */ EXTERN_C UINT VALAPI ValueInt64DataSet( VALUE* pval, INT64 data, UINT type, UINT units ); /** * ValueFloatData - retreive FLOAT_VALUE (double) data of T_FLOAT and T_LENGTH values. */ EXTERN_C UINT VALAPI ValueFloatData( const VALUE* pval, FLOAT_VALUE* pData ); /** * ValueFloatDataSet - sets FLOAT_VALUE data of T_FLOAT and T_LENGTH values. */ EXTERN_C UINT VALAPI ValueFloatDataSet( VALUE* pval, FLOAT_VALUE data, UINT type, UINT units ); /** * ValueBinaryData - retreive integer data of T_BYTES type */ EXTERN_C UINT VALAPI ValueBinaryData( const VALUE* pval, LPCBYTES* pBytes, UINT* pnBytes ); /** * ValueBinaryDataSet - sets VALUE to sequence of bytes of type T_BYTES * 'type' here must be set to T_BYTES. Optionally sets units field too. * The function creates local copy of bytes in its own storage. */ EXTERN_C UINT VALAPI ValueBinaryDataSet( VALUE* pval, LPCBYTES pBytes, UINT nBytes, UINT type, UINT units ); /** * ValueElementsCount - retreive number of sub-elements for: * - T_ARRAY - number of elements in the array; * - T_MAP - number of key/value pairs in the map; * - T_FUNCTION - number of arguments in the function; */ EXTERN_C UINT VALAPI ValueElementsCount( const VALUE* pval, INT* pn); /** * ValueNthElementValue - retreive value of sub-element at index n for: * - T_ARRAY - nth element of the array; * - T_MAP - value of nth key/value pair in the map; * - T_FUNCTION - value of nth argument of the function; */ EXTERN_C UINT VALAPI ValueNthElementValue( const VALUE* pval, INT n, VALUE* pretval); /** * ValueNthElementValueSet - sets value of sub-element at index n for: * - T_ARRAY - nth element of the array; * - T_MAP - value of nth key/value pair in the map; * - T_FUNCTION - value of nth argument of the function; * If the VALUE is not of one of types above then it makes it of type T_ARRAY with * single element - 'val_to_set'. */ EXTERN_C UINT VALAPI ValueNthElementValueSet( VALUE* pval, INT n, const VALUE* pval_to_set); /**Callback function used with #ValueEnumElements(). * return TRUE to continue enumeration */ typedef BOOL CALLBACK KeyValueCallback( LPVOID param, const VALUE* pkey, const VALUE* pval ); /** * ValueEnumElements - enumeartes key/value pairs of T_MAP, T_FUNCTION and T_OBJECT values * - T_MAP - key of nth key/value pair in the map; * - T_FUNCTION - name of nth argument of the function (if any); */ EXTERN_C UINT VALAPI ValueNthElementKey( const VALUE* pval, INT n, VALUE* pretval); EXTERN_C UINT VALAPI ValueEnumElements( VALUE* pval, KeyValueCallback* penum, LPVOID param); /** * ValueSetValueToKey - sets value of sub-element by key: * - T_MAP - value of key/value pair with the key; * - T_FUNCTION - value of argument with the name key; * - T_OBJECT (tiscript) - value of property of the object * If the VALUE is not of one of types above then it makes it of type T_MAP with * single pair - 'key'/'val_to_set'. * * key usually is a value of type T_STRING * */ EXTERN_C UINT VALAPI ValueSetValueToKey( VALUE* pval, const VALUE* pkey, const VALUE* pval_to_set); /** * ValueGetValueOfKey - retrieves value of sub-element by key: * - T_MAP - value of key/value pair with the key; * - T_FUNCTION - value of argument with the name key; * - T_OBJECT (tiscript) - value of property of the object * Otherwise *pretval will have T_UNDEFINED value. */ EXTERN_C UINT VALAPI ValueGetValueOfKey( const VALUE* pval, const VALUE* pkey, VALUE* pretval); enum VALUE_STRING_CVT_TYPE { CVT_SIMPLE, ///< simple conversion of terminal values CVT_JSON_LITERAL, ///< json literal parsing/emission CVT_JSON_MAP, ///< json parsing/emission, it parses as if token '{' already recognized }; /** * ValueToString - converts value to T_STRING inplace: * - CVT_SIMPLE - parse/emit terminal values (T_INT, T_FLOAT, T_LENGTH, T_STRING) * - CVT_JSON_LITERAL - parse/emit value using JSON literal rules: {}, [], "string", true, false, null * - CVT_JSON_MAP - parse/emit MAP value without enclosing '{' and '}' brackets. */ EXTERN_C UINT VALAPI ValueToString( VALUE* pval, /*VALUE_STRING_CVT_TYPE*/ UINT how ); /** * ValueFromString - parses string into value: * - CVT_SIMPLE - parse/emit terminal values (T_INT, T_FLOAT, T_LENGTH, T_STRING), "guess" non-strict parsing * - CVT_JSON_LITERAL - parse/emit value using JSON literal rules: {}, [], "string", true, false, null * - CVT_JSON_MAP - parse/emit MAP value without enclosing '{' and '}' brackets. * Returns: * Number of non-parsed characters in case of errors. Thus if string was parsed in full it returns 0 (success) */ EXTERN_C UINT VALAPI ValueFromString( VALUE* pval, LPCWSTR str, UINT strLength, /*VALUE_STRING_CVT_TYPE*/ UINT how ); /** * ValueInvoke - function invocation (Sciter/TIScript). * - VALUE* pval is a value of type T_OBJECT/UT_OBJECT_FUNCTION * - VALUE* pthis - object that will be known as 'this' inside that function. * - UINT argc, const VALUE* argv - vector of arguments to pass to the function. * - VALUE* pretval - parse/emit MAP value without enclosing '{' and '}' brackets. * - LPCWSTR url - url or name of the script - used for error reporting in the script. * Returns: * HV_OK, HV_BAD_PARAMETER or HV_INCOMPATIBLE_TYPE */ EXTERN_C UINT VALAPI ValueInvoke( VALUE* pval, VALUE* pthis, UINT argc, const VALUE* argv, VALUE* pretval, LPCWSTR url); #if defined(__cplusplus) #include <string> #include "aux-slice.h" #include "aux-cvt.h" #pragma warning( push ) #pragma warning(disable:4786) //identifier was truncated... namespace json { inline void str_copy(char* dst,const char* src, unsigned n ) { dst && src? strncpy(dst,src,n):0; } inline void str_copy(wchar_t* dst,const wchar_t* src, unsigned n ) { dst && src? wcsncpy(dst,src,n):0; } inline int str_length(const char* src ) { return src? strlen(src):0; } inline int str_length(const wchar_t* src ) { return src? wcslen(src):0; } template<typename TC> class string_t { struct data { mutable volatile unsigned rc; unsigned length; TC chars[1]; }; data* _data; void init( const TC* s, unsigned n ) { assert(_data == 0); if(!s || !n) return; _data = (data*)malloc(sizeof(data) + sizeof(TC) * n); if(_data) { str_copy(_data->chars,s,n); _data->rc = 1; _data->length = n; _data->chars[n] = 0; } } void init( data* pd ) { _data = pd; if(_data) ++(_data->rc); } public: string_t(): _data(0) {} string_t(const TC* s) : _data(0) { init(s, (unsigned int)( str_length(s)) ); } string_t(const TC* s, unsigned length) : _data(0) { init(s,length); } string_t(aux::slice<TC> wc) : _data(0) { init(wc.start,wc.length); } string_t(const string_t& s) : _data(0) { init(s._data); } string_t& operator = ( const string_t& s ) { clear(); init(s._data); return *this; } string_t& operator = ( const TC* s ) { clear(); init(s,(unsigned int)(str_length(s))); return *this; } ~string_t() { clear(); } const TC* c_str() const { static TC z = 0; return _data?_data->chars:&z; } unsigned length() const { return _data?_data->length: 0; } void clear() { if(_data && (--(_data->rc) == 0)) { free(_data); _data = 0; } } operator const TC*() const { return c_str(); } operator const aux::slice<TC>() const { return aux::slice<TC>(c_str(), length()); } bool operator == (aux::slice<TC> rs) const { return aux::slice<TC>(c_str(), length()) == rs; } bool operator != (aux::slice<TC> rs) const { return aux::slice<TC>(c_str(), length()) != rs; } }; // wide (utf16) string typedef string_t<wchar_t> string; // ascii or utf8 string typedef string_t<char> astring; // value by key bidirectional proxy/accessor class value_key_a; // value by index bidirectional proxy/accessor class value_idx_a; class value: public VALUE { value(void*) {} // no such thing, sorry //void* get(const void* defv) const { return 0; } // and this one too is disabled //void* get(const void* defv) { return 0; } // and this one too is disabled public: value() { ValueInit(this); } ~value() { ValueClear(this); } value(const value& src) { ValueInit(this); ValueCopy(this,&src); } value(const VALUE& src) { ValueInit(this); ValueCopy(this,&src); } value& operator = (const value& src) { ValueCopy(this,&src); return *this; } value& operator = (const VALUE& src) { ValueCopy(this,&src); return *this; } value( bool v ) { ValueInit(this); ValueIntDataSet(this, v?1:0, T_BOOL, 0); } value( int v ) { ValueInit(this); ValueIntDataSet(this, v, T_INT, 0); } value( double v ) { ValueInit(this); ValueFloatDataSet(this, v, T_FLOAT, 0); } value( const wchar_t* s, unsigned int slen = 0 ) { ValueInit(this); ValueStringDataSet(this, s, (slen || !s)? slen : (unsigned int)wcslen(s), 0); } value( const string& s ) { ValueInit(this); ValueStringDataSet(this, s.c_str(), s.length(), 0); } value( const std::wstring& s ) { ValueInit(this); ValueStringDataSet(this, s.c_str(), s.length(), 0); } value( const std::string& s ) { aux::a2w as(s.c_str()); ValueInit(this); ValueStringDataSet(this, as, as.length(), UT_SYMBOL); } value( aux::bytes bs ) { ValueInit(this); ValueBinaryDataSet(this, bs.start, bs.length, T_BYTES, 0); } value( const value* arr, unsigned n ) { ValueInit(this); for( unsigned i = 0; i < n; ++i ) set_item(i,arr[i]); } static value currency( INT64 v ) { value t; ValueInt64DataSet(&t, v, T_CURRENCY, 0); return t;} static value date( INT64 v ) { value t; ValueInt64DataSet(&t, v, T_DATE, 0); return t;} #ifdef WIN32 static value date( FILETIME ft ) { value t; ValueInt64DataSet(&t, *((INT64*)&ft), T_DATE, 0); return t;} #endif static value symbol( aux::wchars wc ) { value t; ValueInit(&t); ValueStringDataSet(&t, wc.start, wc.length , 0xFFFF); return t; } // string-symbol value( const char* s ) { aux::a2w as(s); ValueInit(this); ValueStringDataSet(this, as, as.length(), UT_SYMBOL); } bool is_undefined() const { return t == T_UNDEFINED; } bool is_bool() const { return t == T_BOOL; } bool is_int() const { return t == T_INT; } bool is_float() const { return t == T_FLOAT; } bool is_string() const { return t == T_STRING; } bool is_symbol() const { return t == T_STRING && u == UT_SYMBOL; } bool is_date() const { return t == T_DATE; } bool is_currency() const { return t == T_CURRENCY; } bool is_map() const { return t == T_MAP; } bool is_array() const { return t == T_ARRAY; } bool is_function() const { return t == T_FUNCTION; } bool is_bytes() const { return t == T_BYTES; } bool is_object() const { return t == T_OBJECT; } bool is_dom_element() const { return t == T_DOM_OBJECT; } bool is_null() const { return t == T_NULL; } static value null() { value n; n.t = T_NULL; return n; } bool operator == (const value& rs) const { if( this == &rs ) return true; switch(ValueCompare( this, &rs )) { case HV_OK: return false; case HV_OK_TRUE: return true; default: assert(false); } return false; } bool operator != (const value& rs) const { return !(operator==(rs)); } int get(int defv) const { int v; if(ValueIntData(this,&v) == HV_OK) return v; return defv; } double get(double defv) const { double v; if(ValueFloatData(this,&v) == HV_OK) return v; return defv; } string get(const wchar_t* defv) const { aux::wchars wc; if(ValueStringData(this,&wc.start,&wc.length) == HV_OK) return string(wc); return string(defv); } aux::wchars get_chars() const { aux::wchars s; ValueStringData(this,&s.start,&s.length); return s; } aux::bytes get_bytes() const { aux::bytes bs; ValueBinaryData(this,&bs.start,&bs.length); return bs; } #ifdef WIN32 FILETIME get_date() const { INT64 v; if(ValueInt64Data(this,&v) == HV_OK) return *((FILETIME*)&v); return FILETIME(); } #endif bool get(bool defv) const { int v; if(ValueIntData(this,&v) == HV_OK) return v != 0; return defv; } static value from_string(const wchar_t* s, unsigned int len = 0, VALUE_STRING_CVT_TYPE ct = CVT_SIMPLE) { value t; if( s ) { if(len == 0) len = (unsigned int)wcslen(s); ValueFromString( &t, s, len, ct ); } return t; } static value from_string(const std::wstring& s, VALUE_STRING_CVT_TYPE ct = CVT_SIMPLE) { return from_string(s.c_str(), (unsigned int)s.length(),ct); } static value from_string(aux::wchars s, VALUE_STRING_CVT_TYPE ct = CVT_SIMPLE) { return from_string(s.start, s.length,ct); } string to_string(int how = CVT_SIMPLE) const { if( how == CVT_SIMPLE && is_string() ) return string(get_chars()); // do not need to allocate value t = *this; ValueToString(&t,how); return string(t.get_chars()); } void clear() { ValueClear(this); } // if it is an array or map returns number of elements there, otherwise - 0 // if it is a function - returns number of arguments int length() const { int n = 0; ValueElementsCount( this, &n); return n; } // if it is an array - returns nth element // if it is a map - returns nth value of the map // if it is a function - returns nth argument // otherwise it returns undefined value value get_item(int n) const { value r; ValueNthElementValue( this, n, &r); return r; } const value operator[](int n) const { return get_item(n); } value_idx_a operator[](int n); // if it is a map - returns value under the key in the map // if it is a function - returns value of argument with the name // otherwise it returns undefined value const value operator[](const value& key) const { return get_item(key); } value_key_a operator[](const value& key); struct enum_cb { // return true to continue enumeration virtual bool on(const value& key, const value& val) = 0; static BOOL CALLBACK _callback( LPVOID param, const VALUE* pkey, const VALUE* pval ) { enum_cb* cb = (enum_cb*)param; return cb->on( *(value*)pkey, *(value*)pval ); } }; // enum void enum_elements(enum_cb& cb) const { ValueEnumElements(const_cast<value*>(this), &enum_cb::_callback, &cb); } value key(int n) const { value r; ValueNthElementKey( this, n, &r); return r; } // if it is an array - sets nth element expanding the array if needed // if it is a map - sets nth value of the map; // if it is a function - sets nth argument of the function; // otherwise it converts this to array and adds v as first element. void set_item(int n, const value& v) { ValueNthElementValueSet( this, n, &v); } void append(const value& v) { ValueNthElementValueSet( this, length(), &v); } // if it is a map - sets named value in the map; // if it is a function - sets named argument of the function; // otherwise it converts this to map and adds key/v to it. void set_item(const value& key, const value& v) { ValueSetValueToKey( this,&key,&v ); } const value get_item(const value& key) const { value r; ValueGetValueOfKey( this, &key, &r); return r; } // T_OBJECT and T_DOM_OBJECT only, get value of object's data slot void* get_object_data() const { LPCBYTES pv = 0; unsigned int dummy; UINT r = ValueBinaryData(this,&pv,&dummy); r; assert(r == HV_OK); return (void*)pv; } // // Below this point are TISCRIPT/SCITER related methods // #if defined(HAS_TISCRIPT) bool is_object_native() const { return t == T_OBJECT && u == UT_OBJECT_NATIVE; } bool is_object_array() const { return t == T_OBJECT && u == UT_OBJECT_ARRAY; } bool is_object_function() const { return t == T_OBJECT && u == UT_OBJECT_FUNCTION; } bool is_object_object() const { return t == T_OBJECT && u == UT_OBJECT_OBJECT; } // that is plain TS object bool is_object_class() const { return t == T_OBJECT && u == UT_OBJECT_CLASS; } // that is TS class bool is_object_error() const { return t == T_OBJECT && u == UT_OBJECT_ERROR; } // that is TS error // T_OBJECT only, set value of object's data slot void set_object_data(void* pv) { assert(u == UT_OBJECT_NATIVE); ValueBinaryDataSet(this,(LPCBYTES)pv,1,T_OBJECT,0); } // T_OBJECT only, class name of the object: e.g. Array, Function, etc. or custom class name. //std::wstring get_object_class_name() const //{ // assert(is_object()); // return get(L""); //} // T_OBJECT/UT_OBJECT_FUNCTION only, call TS function // 'self' here is what will be known as 'this' inside the function, can be undefined for invocations of global functions value call( int argc, const value* argv, value self = value(), const wchar_t* url_or_script_name = 0) { value rv; ValueInvoke(this,&self,argc,argv,&rv,url_or_script_name); return rv; } void isolate() { ValueIsolate(this); } #endif //defined(HAS_TISCRIPT) // "smart" or "soft" equality test static bool equal(const value& v1, const value& v2) { if( v1 == v2 ) return true; // strict comparison switch ( v1.t > v2.t? v1.t: v2.t ) { case T_BOOL: { bool const r1 = v1.get(false); bool const r2 = v2.get(!r1); return r1 == r2; } case T_INT: { int const r1 = v1.get(0); int const r2 = v2.get(-r1); return r1 == r2; } case T_FLOAT: { double const r1 = v1.get(0.0); double const r2 = v2.get(-r1); return r1 == r2; } } return false; } }; // value by key bidirectional proxy/accessor class value_key_a { friend class value; value& col; value key; value_key_a& operator=(const value_key_a& val) { val; return *this; } // no such thing protected: value_key_a( value& c, const value& k ): col(c),key(k) {} public: ~value_key_a() {} value_key_a& operator= (const value& val) { col.set_item(key,val); return *this; } operator const value() const { return col.get_item(key); } }; inline value_key_a value::operator[](const value& key) { return value_key_a(*this, key); } // value by index bidirectional proxy/accessor class value_idx_a { friend class value; value& col; int idx; value_idx_a& operator= (const value_idx_a& val) { val; return *this; } // no such thing protected: value_idx_a( value& c, int i ): col(c), idx(i) {} public: ~value_idx_a() {} value_idx_a& operator= (const value& val) { col.set_item(idx,val); return *this; } operator const value() const { return col.get_item(idx); } }; inline value_idx_a value::operator[](int idx) { return value_idx_a(*this, idx); } } #pragma warning( pop ) #endif //defined(__cplusplus) #endif i don't know how to pass several args.
  3. ;typedef json::value SCITER_VALUE; ;EXTERN_C BOOL SCAPI SciterCall(HWND hWnd, LPCSTR functionName, UINT argc, const SCITER_VALUE* argv, SCITER_VALUE* retval); Func _StCall($STHwnd) $result = DllCall($Sciterdll, "BOOL", "SciterCall", "HWND", $STHwnd, "str", "showValues", "UINT", 0, "ptr", 0, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[5] EndFunc i don't know how to send SCITER_VALUE* argv, someone can help me ?
  4. <html> <head> <title>View (window) events</title> <style> html { background-color:transparent; font:10pt Verdana; //overflow:hidden; background-color:rgba(137,120,137,1); //background-color:transparent; //background-image:url(back.png); //background-repeat:expand; //background-position:8px 8px 8px 8px; OVERFLOW-Y: hidden; } body { //padding:3px; margin:0; width:100%%; height:100%%; OVERFLOW-Y: hidden; //prototype: Body; //background-color:transparent; min-height:500px; } #topbar { padding:3px; background-color:rgba(137,0,137,0.55); flow:horizontal; margin-bottom:3px; } #topbar #window-caption { color: #274749; //background-color: white; //opacity: 0.75; padding:0 4px; margin:0 4px; height:*; outline:3px glow #B0CFD1 1px; } #window-content { background-color:transparent; padding:3px; width:100%%; height:100%%; overflow:hidden; } #topbar widget[type="button"] { width:1em; height:1em; background-image:none; transition:none; padding:1px; font-family: marlett; font-size:10pt; color: #274749; border:1px solid #B0CFD1; text-align:center; vertical-align:center; margin:0; } #topbar widget[type="button"]:hover { color:orange; border-color:orange; background-color:#B0CFD1; } #topbar widget[type="button"]:active { background-color:#274749; } #topbar widget#window-minimize, #topbar widget#window-maximize { margin-right:2px; } #topbar widget#window-icon { foreground-image:url(icon.png); foreground-repeat:no-repeat; foreground-position:50% 50%; } #bottombar { background-color:rgba(137,130,0,0.75); margin-top:3px; flow:horizontal; } #bottombar #window-corner { margin-top:100%%; font-family: marlett; font-size:15pt; color: #274749; width:min-intrinsic; } #bottombar #window-status { color: #274749; font-size:9pt; margin:0; } .hcontainer { width:100%%; height:100%%; flow:horizontal; behavior:frame-set; border-spacing: 4px; /* width of splitter */ } #top { width:100%%; height:200px; border-spacing: 4px; /* width of splitter */ background-color:window; } .left { height:100%%; margin:0; width:200px; border:1px solid threedface; background-color:window; } .right { height:100%%; width:100%%; margin:0; border:1px solid threedface; background-color:window; } </style> <script type="text/tiscript"> if( self.parent ) return; // loading in the <frame>, don't do the rest. // this is root document of the view // setup window, remove standard window frame view.frame = false; // onStateChanged handler of the view object function view.onStateChanged() { switch( view.state ) { case View.WINDOW_MAXIMIZED: self.select("#window-maximize").text = "2"; break; case View.WINDOW_SHOWN: self.select("#window-maximize").text = "1"; break; } } /*class Body: Behavior { function attached() { view.move(10,10); } }*/ </script> </head> <body> <div id="topbar"> <widget id="window-icon" type="button"></widget> <div id="window-caption">Sciter skinned window sample</div> <widget id="window-minimize" type="button">0</widget> <widget id="window-maximize" type="button">1</widget> <widget id="window-close" type="button">r</widget> </div> <div id="window-content"> <div id="top"> Top </div> <div class="hcontainer"> <div class="left" style="min-width:100px;">Left 200px fixed</div> <div class="right">right</div> </div> </div> <div id="bottombar"> <p id="window-status">This is the <i>status</i>...</p> <div id="window-corner">o</div> </div> </body> </html> if you don't want the sizer between left and right remove "behavior:frame-set;" in .hcontainer
  5. try this : <html> <head> <title>View (window) events</title> <style> html { background-color:transparent; font:10pt Verdana; //overflow:hidden; background-color:rgba(137,120,137,1); //background-color:transparent; //background-image:url(back.png); //background-repeat:expand; //background-position:8px 8px 8px 8px; OVERFLOW-Y: hidden; } body { //padding:3px; margin:0; width:100%%; height:100%%; OVERFLOW-Y: hidden; //prototype: Body; //background-color:transparent; min-height:500px; } #topbar { padding:3px; background-color:rgba(137,0,137,0.55); flow:horizontal; margin-bottom:3px; } #topbar #window-caption { color: #274749; //background-color: white; //opacity: 0.75; padding:0 4px; margin:0 4px; height:*; outline:3px glow #B0CFD1 1px; } #window-content { background-color:transparent; padding:3px; width:100%%; height:100%%; overflow:hidden; } #topbar widget[type="button"] { width:1em; height:1em; background-image:none; transition:none; padding:1px; font-family: marlett; font-size:10pt; color: #274749; border:1px solid #B0CFD1; text-align:center; vertical-align:center; margin:0; } #topbar widget[type="button"]:hover { color:orange; border-color:orange; background-color:#B0CFD1; } #topbar widget[type="button"]:active { background-color:#274749; } #topbar widget#window-minimize, #topbar widget#window-maximize { margin-right:2px; } #topbar widget#window-icon { foreground-image:url(icon.png); foreground-repeat:no-repeat; foreground-position:50% 50%; } #bottombar { background-color:rgba(137,130,0,0.75); margin-top:3px; flow:horizontal; } #bottombar #window-corner { margin-top:100%%; font-family: marlett; font-size:15pt; color: #274749; width:min-intrinsic; } #bottombar #window-status { color: #274749; font-size:9pt; margin:0; } .hcontainer { width:100%%; height:100%%; flow:horizontal; behavior:frame-set; border-spacing: 4px; /* width of splitter */ } #top { flow:horizontal; width:100%%; height:200px; behavior:frame-set; border-spacing: 4px; /* width of splitter */ background-color:window; } .vcontainer { width:100%%; height:100%%; flow:vertical; behavior:frame-set; border-spacing: 4px; /* width of splitter */ } .left { height:100%%; margin:0; width:200px; border:1px solid threedface; background-color:window; } .right { height:100%%; width:100%%; margin:0; border:1px solid threedface; background-color:window; } </style> <script type="text/tiscript"> if( self.parent ) return; // loading in the <frame>, don't do the rest. // this is root document of the view // setup window, remove standard window frame view.frame = false; // onStateChanged handler of the view object function view.onStateChanged() { switch( view.state ) { case View.WINDOW_MAXIMIZED: self.select("#window-maximize").text = "2"; break; case View.WINDOW_SHOWN: self.select("#window-maximize").text = "1"; break; } } /*class Body: Behavior { function attached() { view.move(10,10); } }*/ </script> </head> <body> <div id="topbar"> <widget id="window-icon" type="button"></widget> <div id="window-caption">Sciter skinned window sample</div> <widget id="window-minimize" type="button">0</widget> <widget id="window-maximize" type="button">1</widget> <widget id="window-close" type="button">r</widget> </div> <div id="window-content" class="vcontainer" > <div id="top"> Top : min height=200px </div> <div class="hcontainer"> <div class="left" style="min-width:100px;">Left 200px fixed</div> <div class="right">right</div> </div> </div> <div id="bottombar"> <p id="window-status">This is the <i>status</i>...</p> <div id="window-corner">o</div> </div> </body> </html> i found in html_samples\frames\behaviors.htm htmlayout support <include> tag for include your 3 html file in this. see http://www.terrainformatica.com/htmlayout/tags.whtm
  6. You want display url or your html in frame ?
  7. Can you post your code ? in most case specify width in your top div resolve the problem
  8. i don't understand your problem, you want width of top frame not resize ? if yes, a simple width:200px; in css work.
  9. New version is up, try "Ex skin.au3" exemple for skinning window
  10. Demo is not autoit apps, il you want c++ source download HtmLayout SDK see "Ex func.au3" and "Ex OSD menu.au3" in 7zip file.
  11. Sciter UDF is out, try osd menu exemple.
  12. Sciter is a HTML/CSS renderer and layout manager. you can make powerfull html gui. you need sciter-x.dll from Sciter SDK you can also download HtmLayout Demo for see lot of exemples of use. (run browse.exe in bin folder and open htm file in html_samples) #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Sciter-Constants.au3> #include-once Global $aHLelementsfound = 0 Global $Sciterdll = 0 Global $SciterRef = 0 Global $HandleWindowsAttachEvent = 0 Global $SciterEvHandler = 0 Global $aHLDOM_error[7] Global $sciterhtml $aHLDOM_error[0] = "function completed successfully" $aHLDOM_error[1] = "invalid HWND" $aHLDOM_error[2] = "invalid HELEMENT" $aHLDOM_error[3] = "attempt to use HELEMENT which is not marked by Sciter_UseElement()" $aHLDOM_error[4] = "parameter is invalid, e.g. pointer is null" $aHLDOM_error[5] = "operation failed, e.g. invalid html in SciterSetElementHtml()" $aHLDOM_error[6] = "Dllcall error" ; #FUNCTION# ==================================================================================================== ; Name...........: _StStartup ; Description....: Initialize Sciter ; Syntax.........: _StStartup($dll = "Sciter-x.dll") ; Parameters.....: $dll - Path to sciter DLL [Optional] ; ; Return values..: Success - 1 ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _StStartup($dll = "Sciter-x.dll") ;ok $SciterRef += 1 If $SciterRef > 1 Then Return 1 $Sciterdll = DllOpen($dll) If $Sciterdll = -1 Then Return SetError(1, 0, 0) Return 1 EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _StCreate ; Description....: Create Sciter Windows ; Syntax.........: _StCreate($x = 0, $y = 0, $w = 100, $h = 50) ; Parameters.....: $x - [Optional] ; $y - [Optional] ; $w - [Optional] ; $h - [Optional] ; ; Return values..: Success - Sciter window handle. ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _StCreate($x = 0, $y = 0, $w = 100, $h = 50) ;ok If $x = -1 Then $x = @DesktopWidth / 2 - ($w/2) If $y = -1 Then $y = @DesktopHeight / 2 - ($h/2) $result = DllCall($Sciterdll, "wstr", "SciterClassNameW") If @error Then Return 0 $ClassName = $result[0] $SciterHwnd = _WinAPI_CreateWindowEx(BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW ), $ClassName, "", BitOR($WS_VISIBLE,$WS_popup,$WS_CLIPCHILDREN), $x, $y, $w, $h,0) Return $SciterHwnd EndFunc ;==>_StCreateGui ; #FUNCTION# ==================================================================================================== ; Name...........: _StIncGui ; Description....: Create Sciter Windows as child of $ParentGui ; Syntax.........: _StIncGui($ParentGui, $x = 0, $y = 0, $w = 100, $h = 50) ; Parameters.....: $ParentGui - Handle of parent Gui ; $x - [Optional] ; $y - [Optional] ; $w - [Optional] ; $h - [Optional] ; ; Return values..: Success - Sciter window handle. ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _StIncGui($ParentGui, $x = 0, $y = 0, $w = 100, $h = 50) ;ok $result = DllCall($Sciterdll, "wstr", "SciterClassNameW") If @error Then Return 0 $ClassName = $result[0] $SciterHwnd = _WinAPI_CreateWindowEx(0, $ClassName, "", BitOR($WS_CHILD, $WS_VISIBLE,$WS_CLIPCHILDREN), $x, $y, $w, $h,$ParentGui) Return $SciterHwnd EndFunc ;==>_StIncGui ; #FUNCTION# ==================================================================================================== ; Name...........: _StLoadFile ; Description....: Load HTML file. ; Syntax.........: _StLoadFile($STHwnd, $file) ; Parameters.....: $STHwnd - Sciter window handle. ; $file - File name of an HTML file. ; ; Return values..: Success - 1 ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _StLoadFile($STHwnd, $file) ;ok $result = DllCall($Sciterdll, "BOOL", "SciterLoadFile", "HWND", $STHwnd, "wstr", $file) If @error Then Return 0 Return $result[0] EndFunc ;==>_StLoadFile ; #FUNCTION# ==================================================================================================== ; Name...........: _StLoadHtml ; Description....: Load HTML from memory. ; Syntax.........: _StLoadHtml($STHwnd, $String) ; Parameters.....: $STHwnd - Sciter window handle. ; $String - HTML to load. ; ; Return values..: Success - 1 ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _StLoadHtml($STHwnd, $String) ;ok $StringSize = StringLen($String) $result = DllCall($Sciterdll, "BOOL", "SciterLoadHtml", "HWND", $STHwnd, "str", $String, "UINT", $StringSize, "str", @ScriptDir) If @error Then Return SetError(@error,0,0) Return 1 EndFunc ;==>_StLoadHtml ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetRootElement ; Description....: Get root DOM element of HTML document. ; Syntax.........: _StGetRootElement($STHwnd) ; Parameters.....: $STHwnd - Sciter window handle. ; ; Return values..: Success - Return root element. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: Root DOM object is always a 'HTML' element of the document. ; =============================================================================================================== Func _StGetRootElement($STHwnd) ;ok $result = DllCall($Sciterdll, "int", "SciterGetRootElement", "HWND", $STHwnd, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_StGetRootElement ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetElementHtml ; Description....: Get Html of the element. ; Syntax.........: _StGetElementHtml($el, $outer = 1) ; Parameters.....: $el - DOM element handle ; $outer - BOOL, if TRUE will return outer HTML otherwise inner. [Optional] ; ; Return values..: Success - Return Html of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StGetElementHtml($el, $outer = 1) ;ok $sciterhtml = "" $LPCBYTE_RECEIVER = DllCallbackRegister("SciterByteCallback", "ptr", "str;UINT;ptr") $result = DllCall($Sciterdll, "int", "SciterGetElementHtmlCB", "ptr", $el, "BOOL", $outer, "ptr", DllCallbackGetPtr($LPCBYTE_RECEIVER), "ptr", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) DllCallbackFree($LPCBYTE_RECEIVER) Return $sciterhtml EndFunc Func SciterByteCallback($byte,$num,$prm) $sciterhtml = BinaryToString($byte,4) EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _StSetElementHtml ; Description....: Set inner or outer html of the element. ; Syntax.........: _StSetElementHtml($el, $html, $where) ; Parameters.....: $el - DOM element handle ; $html - string containing html text ; $where - possible values are: ; 0: replace content of the element ; 1: insert html before first child of the element ; 2: insert html after last child of the element ; 3: replace element by html, a.k.a. element.outerHtml = "something" ; 4: insert html before the element ; 5: insert html after the element ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: Value 3,4 and 5 for $where do not work for inline elements like ; =============================================================================================================== Func _StSetElementHtml($el, $html, $where = 0) ;ok $htmllen = StringLen($html) $result = DllCall($Sciterdll, "int", "SciterSetElementHtml", "ptr", $el, "str", $html, "DWORD", $htmllen, "UINT", $where) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return 1 EndFunc ;==>_StSetElementHtml ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetElementText ; Description....: Get inner text of the element ; Syntax.........: _StGetElementText($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - return text element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StGetElementText($el) ;ok $sciterhtml = "" $LPCWSTR_RECEIVER = DllCallbackRegister("SciterWSTRCallback", "ptr", "wstr;UINT;ptr") $result = DllCall($Sciterdll, "int", "SciterGetElementTextCB", "ptr", $el, "ptr", DllCallbackGetPtr($LPCWSTR_RECEIVER), "ptr", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) DllCallbackFree($LPCWSTR_RECEIVER) Return $sciterhtml EndFunc Func SciterWSTRCallback($wstr,$num,$prm) $sciterhtml = $wstr EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _StSetElementText ; Description....: Set inner text of the element. ; Syntax.........: _StSetElementText($el, $String) ; Parameters.....: $el - DOM element handle ; $String - Innertext ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StSetElementText($el, $String) ;ok $len = StringLen($String) $result = DllCall($Sciterdll, "int", "SciterSetElementText", "ptr", $el, "wstr", $String, "UINT", $len) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return 1 EndFunc ;==>_StSetElementText ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetChildrenCount ; Description....: Get number of child elements. ; Syntax.........: _StGetChildrenCount($el) ; Parameters.....: $el - DOM element handle which child elements you need to count ; ; Return values..: Success - Return number of child elements ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StGetChildrenCount($el) ;ok $result = DllCall($Sciterdll, "int", "SciterGetChildrenCount", "ptr", $el, "UINT*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_StGetChildrenCount ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetFocusElement ; Description....: Get focused DOM element of HTML document. ; Syntax.........: _StGetFocusElement($hwnd) ; Parameters.....: $hwnd - Sciter windows handle ; ; Return values..: Success - Return focus element or 0 if no focus ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: To set focus on element use _StSetElementState($el, $STATE_FOCUS,0) ; =============================================================================================================== Func _StGetFocusElement($hwnd) ;ok $result = DllCall($Sciterdll, "int", "SciterGetFocusElement", "HWND", $hwnd, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[2] EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetElementState ; Description....: Get state bits, see ELEMENT_STATE_BITS in "Sciter-constants.au3" ; Syntax.........: _StGetElementState($el) ; Parameters.....: $el - Dom element handle ; ; Return values..: Success - Return Statebits ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StGetElementState($el) ;ok $result = DllCall($Sciterdll, "int", "SciterGetElementState", "ptr", $el, "UINT*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[2] EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _StSetElementState ; Description....: Set state bits, see ELEMENT_STATE_BITS in "Sciter-constants.au3" ; Syntax.........: _StSetElementState($el, $stateToSet, $stateToClear = 0, $upt = 1) ; Parameters.....: $el - Dom handle element ; $stateToSet - ; $stateToClear - [Optional] ; $upt - [Optional] ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StSetElementState($el, $stateToSet, $stateToClear = 0, $upt = 1) $result = DllCall($Sciterdll, "int", "SciterSetElementState", "ptr", $el, "UINT", $stateToSet, "UINT", $stateToClear, "BOOL", $upt) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return 1 EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetNthChild ; Description....: Get handle of Nth child element. ; Syntax.........: _StGetNthChild($el, $nth) ; Parameters.....: $el - DOM element handle ; $nth - number of the child element ; ; Return values..: Success - Return handle of the child element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StGetNthChild($el, $nth) ;ok $result = DllCall($Sciterdll, "int", "SciterGetNthChild", "ptr", $el, "UINT", $nth-1, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[3] EndFunc ;==>_StGetNthChild ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetParentElement ; Description....: Get parent element. ; Syntax.........: _StGetParentElement($el) ; Parameters.....: $el - DOM element handle which parent you need ; ; Return values..: Success - Return handle of the parent element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StGetParentElement($el) ;ok $result = DllCall($Sciterdll, "int", "SciterGetParentElement", "ptr", $el, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_StGetParentElement ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetAttributeCount ; Description....: Get number of element's attributes. ; Syntax.........: _StGetAttributeCount($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return number of element attributes. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StGetAttributeCount($el) ;ok $result = DllCall($Sciterdll, "int", "SciterGetAttributeCount", "ptr", $el, "UINT*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_StGetAttributeCount ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetNthAttribute ; Description....: Get value of any element's attribute by attribute's number. ; Syntax.........: _StGetNthAttribute($el, $nth) ; Parameters.....: $el - DOM element handle ; $nth - number of desired attribute ; ; Return values..: Success - Return Array with name and value of attribute. $return[0] = name, $return[1] = value ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StGetNthAttribute($el, $nth);ok $result = DllCall($Sciterdll, "int", "SciterGetNthAttribute", "ptr", $el, "UINT", $nth, "str*", "", "wstr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Dim $aRet[2] $aRet[0] = $result[3] $aRet[1] = $result[4] Return $aRet EndFunc ;==>_StGetNthAttribute ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetAttributeByName ; Description....: Get value of any element's attribute by name. ; Syntax.........: _StGetAttributeByName($el, $AttName) ; Parameters.....: $el - DOM element handle ; $AttName - attribute name ; ; Return values..: Success - Return attribute value ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StGetAttributeByName($el, $AttName);ok $result = DllCall($Sciterdll, "int", "SciterGetAttributeByName", "ptr", $el, "str", $AttName, "wstr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[3] EndFunc ;==>_StGetAttributeByName ; #FUNCTION# ==================================================================================================== ; Name...........: _StSetAttributeByName ; Description....: Set attribute's value. ; Syntax.........: _StSetAttributeByName($el, $AttName, $value) ; Parameters.....: $el - DOM element handle ; $AttName - attribute name ; $value - new attribute value or 0 if you want to remove attribute. ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StSetAttributeByName($el, $AttName, $value) ;ok $result = DllCall($Sciterdll, "int", "SciterSetAttributeByName", "ptr", $el, "str", $AttName, "wstr", $value) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return 1 EndFunc ;==>_StSetAttributeByName ; #FUNCTION# ==================================================================================================== ; Name...........: _StClearAttributes ; Description....: Remove all attributes from the element. ; Syntax.........: _StClearAttributes($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StClearAttributes($el) ;ok $result = DllCall($Sciterdll, "int", "SciterClearAttributes", "ptr", $el) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return 1 EndFunc ;==>_StClearAttributes ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetElementIndex ; Description....: Get element index. ; Syntax.........: _StGetElementIndex($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return index of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StGetElementIndex($el) ;ok $result = DllCall($Sciterdll, "int", "SciterGetElementIndex", "ptr", $el, "UINT*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_StGetElementIndex ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetElementType ; Description....: Get element's type. ; Syntax.........: _StGetElementType($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return Type of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: For <div> return will be set to "div". ; =============================================================================================================== Func _StGetElementType($el) ;ok $result = DllCall($Sciterdll, "int", "SciterGetElementType", "ptr", $el, "str*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_StGetElementType ; #FUNCTION# ==================================================================================================== ; Name...........: _StGetStyleAttribute ; Description....: Get element's style attribute. ; Syntax.........: _StGetStyleAttribute($el, $StyleName) ; Parameters.....: $el - DOM element handle ; $StyleName - name of the style attribute ; ; Return values..: Success - Return value of the style attribute. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StGetStyleAttribute($el, $StyleName);ok $result = DllCall($Sciterdll, "int", "SciterGetStyleAttribute", "ptr", $el, "str", $StyleName, "wstr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[3] EndFunc ;==>_StGetStyleAttribute ; #FUNCTION# ==================================================================================================== ; Name...........: _StSetStyleAttribute ; Description....: Set element's style attribute. ; Syntax.........: _StSetStyleAttribute($el, $StyleName, $StyleValue) ; Parameters.....: $el - DOM element handle ; $StyleName - name of the style attribute ; $StyleValue - value of the style attribute. ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StSetStyleAttribute($el, $StyleName, $StyleValue);ok $result = DllCall($Sciterdll, "int", "SciterSetStyleAttribute", "ptr", $el, "str", $StyleName, "wstr", $StyleValue) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return 1 EndFunc ;==>_StSetStyleAttribute ; #FUNCTION# ==================================================================================================== ; Name...........: _StCreateElement ; Description....: Create new element, the element is disconnected initially from the DOM. ; Syntax.........: _StCreateElement($tag, $txt = "") ; Parameters.....: $tag - html tag of the element e.g. "div", "option", etc. ; $txt - initial text of the element or "". text here is a plain text. [Optional] ; ; Return values..: Success - Return handle of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StCreateElement($tag, $txt = "");ok If $txt <> "" Then $result = DllCall($Sciterdll, "int", "SciterCreateElement", "str", $tag, "wstr", $txt, "ptr*", "") Else $result = DllCall($Sciterdll, "int", "SciterCreateElement", "str", $tag, "ptr", "", "ptr*", "") EndIf If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[3] EndFunc ;==>_StCreateElement ; #FUNCTION# ==================================================================================================== ; Name...........: _StInsertElement ; Description....: Insert element at index position of parent. ; Syntax.........: _StInsertElement($el, $elparent, $index) ; Parameters.....: $el - Handle element ; $elparent - Handle element of parent ; $index - position of the element in parent collection. ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: It is not an error to provide index greater than elements count in parent - it will be appended. ; =============================================================================================================== Func _StInsertElement($el, $elparent, $index);ok $result = DllCall($Sciterdll, "int", "SciterInsertElement", "ptr", $el, "ptr", $elparent, "UINT", $index) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return 1 EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _StSelectElements ; Description....: Return Array of elements in a DOM that meets specified CSS selectors. ; Syntax.........: _StSelectElements($el, $CssSel) ; Parameters.....: $el - DOM element handle ; $CssSel - comma separated list of CSS selectors, e.g.: div, id, div[align="right"]. ; ; Return values..: Success - Return Array of elements, $return[0] : number of element. ; Failure - Return 0 if no element found else Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: See list of supported selectors: http://terrainformatica.com/Sciter/selectors.whtm ; =============================================================================================================== Func _StSelectElements($el, $CssSel);ok $handle = DllCallbackRegister("StElementsCallback", "BOOL", "ptr;ptr") Dim $aHLelementsfound[1] $result = DllCall($Sciterdll, "int", "SciterSelectElementsW", "ptr", $el, "wstr", $CssSel, "ptr", DllCallbackGetPtr($handle), "ptr", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) DllCallbackFree($handle) $HLelementsCount = UBound($aHLelementsfound) If $HLelementsCount = 1 Then Return 0 $aHLelementsfound[0] = $HLelementsCount-1 Return $aHLelementsfound EndFunc ;==>_StSelectElements Func StElementsCallback($el, $param) Local $iUBound = UBound($aHLelementsfound) ReDim $aHLelementsfound[$iUBound + 1] $aHLelementsfound[$iUBound] = $el EndFunc ;==>_StElementsCallback ; #FUNCTION# ==================================================================================================== ; Name...........: _StSelectParent ; Description....: Find parent of the element by CSS selector. ; Syntax.........: _StSelectParent($el, $CssSel, $depth = 0) ; Parameters.....: $el - DOM element handle ; $CssSel - comma separated list of CSS selectors, e.g.: div, id, div[align="right"]. ; $depth - if depth == 1 then it will test only element itself. ; Use depth = 1 if you just want to test he element for matching given CSS selector(s). ; depth = 0 will scan the whole child parent chain up to the root. [Optional] ; ; Return values..: Success - Return parent of the element. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _StSelectParent($el, $CssSel, $depth = 0) ;ok $result = DllCall($Sciterdll, "int", "SciterSelectParentW", "ptr", $el, "wstr", $CssSel, "UINT", $depth, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return $result[4] EndFunc ;==>_StSelectParent ; #FUNCTION# ==================================================================================================== ; Name...........: _StDeleteElement ; Description....: Delete element. ; Syntax.........: _StDeleteElement($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: After call to this function $el will become invalid. ; =============================================================================================================== Func _StDeleteElement($el) $result = DllCall($Sciterdll, "int", "SciterDeleteElement", "ptr", $el) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) Return 1 EndFunc ;==>_StDeleteElement ;~ EXTERN_C HLDOM_RESULT HLAPI SciterShowPopup (HELEMENT hePopup, HELEMENT heAnchor, UINT placement) ;~ Shows block element (DIV) in popup window. ;~ Func _StShowPopup($Sciterdll, $el, $anchor, $placement) ;~ $result = DllCall($Sciterdll, "int", "SciterShowPopup", "ptr", $el, "ptr", $anchor, "UINT", $placement) ;~ If @error Then Return 0 ;~ Return 1 ;~ EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _StWindowAttachEventHandler ; Description....: Attach/Detach ElementEventProc to the Sciter window. ; Syntax.........: _StWindowAttachEventHandler($hwnd, $func, $events) ; Parameters.....: $hwnd - HWND of Sciter windows ; $func - Function to receive events (need two params eg: $func($ev, $arrayparam) ; $events - Events you want receive (see remarks) ; can be : ;~ $HANDLE_INITIALIZATION : attached/detached ;~ $HANDLE_MOUSE : mouse events ;~ $HANDLE_KEY : key events ;~ $HANDLE_FOCUS : focus events, if this flag is set it also means that element it attached to is focusable ;~ $HANDLE_SCROLL : scroll events ;~ $HANDLE_SIZE : size changed event ;~ $HANDLE_DATA_ARRIVED : requested data () has been delivered ;~ $HANDLE_BEHAVIOR_EVENT : secondary, synthetic events: BUTTON_CLICK, HYPERLINK_CLICK, etc. ;~ $HANDLE_METHOD_CALL : behavior specific methods ;~ $HANDLE_EXCHANGE : system drag-n-drop events ;~ $HANDLE_ALL : all of them ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: For Uppercase type see "Sciter-Constants.au3" ; $HANDLE_MOUSE : $ret[12]=[MOUSE_EVENTS, target el, curs xpos el rel, curs ypos el rel, curs xpos doc rel, curs ypos doc rel, MOUSE_BUTTONS, KEYBOARD_STATES, CURSOR_TYPE, is on icon, el dragged, DRAGGING_TYPE] ; $HANDLE_KEY : $ret[4]=[KEY_EVENTS, target el, key code, KEYBOARD_STATES] ; $HANDLE_FOCUS : $ret[4]=[FOCUS_EVENTS, target el, focus by click, cancel] ; $HANDLE_SCROLL: $ret[4]=[SCROLL_EVENTS, target el, scroll pos, 1 if vert scroll] ; $HANDLE_BEHAVIOR_EVENT : $ret[5]=[BEHAVIOR_EVENTS, target el, source el, EVENT_REASON or EDIT_CHANGED_REASON, data] ; =============================================================================================================== Func _StWindowAttachEventHandler($hwnd, $func, $events) $HandleWindowsAttachEvent = DllCallbackRegister("HLEvHandler", "BOOL", "ptr;ptr;UINT;ptr") $result = DllCall($Sciterdll, "int", "SciterWindowAttachEventHandler", "HWND", $hwnd, "ptr", DllCallbackGetPtr($HandleWindowsAttachEvent), "ptr", "", "UINT", $DISABLE_INITIALIZATION+$events) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then Return SetError($result[0],0,-1) $SciterEvHandler = $func Return 1 EndFunc ;==>_StWindowAttachEventHandler Func HLEvHandler($tag,$el,$ev,$prm) $ap = -1 $a = DllStructCreate("UINT cmd", $prm) $cmd = DllStructGetData($a, "cmd") $a = 0 If $cmd > 32768 Then Return If $ev = $HANDLE_MOUSE Then $str = "UINT cmd;ptr target;DWORD posx;DWORD posy;DWORD pos_documentx;DWORD pos_documenty;UINT button_state;UINT alt_state;UINT cursor_type;BOOL is_on_icon;ptr dragging;UINT dragging_mode" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_KEY Then $str = "UINT cmd;ptr target;UINT key_code;UINT alt_state" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_FOCUS Then $str = "UINT cmd;ptr target;BOOL by_mouse_click;BOOL cancel" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_SCROLL Then $str = "UINT cmd;ptr target;int pos;BOOL vertical" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_BEHAVIOR_EVENT Then $str = "UINT cmd;ptr heTarget;ptr he;UINT reason;ptr data" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_METHOD_CALL Then $str = "UINT cmd;ptr heTarget;ptr he;UINT reason;ptr data" $ap = getstructdata($str,$prm) EndIf Execute ($SciterEvHandler&"("&$ev&",$ap)") EndFunc Func getstructdata($str,$prm) $a = DllStructCreate($str, $prm) $b = StringSplit ( $str, ";") Dim $ret[$b[0]] For $i = 0 To $b[0]-1 $ret[$i] = DllStructGetData($a,$i+1) Next Return $ret EndFunc changelog : 0.2 : Add _StDebug() for display css/html error in scite console. Correct some error in Sciter-constants Add taskbar and title param in _StCreate Add skin gui exemple 0.1 : First releaseCalltips: _StStartup ($dll = "Sciter-x.dll") Initialize Sciter (required: #include <Sciter-UDF.au3>) _StCreate ($x = 0, $y = 0, $w = 100, $h = 50) Create Sciter Windows (required: #include <Sciter-UDF.au3>) _StIncGui ($ParentGui, $x = 0, $y = 0, $w = 100, $h = 50) Create Sciter Windows as child of $ParentGui (required: #include <Sciter-UDF.au3>) _StLoadFile ($STHwnd, $file) Load HTML file. (required: #include <Sciter-UDF.au3>) _StLoadHtml ($STHwnd, $String) Load HTML from memory. (required: #include <Sciter-UDF.au3>) _StGetRootElement ($STHwnd) Get root DOM element of HTML document. (required: #include <Sciter-UDF.au3>) _StGetElementHtml ($el, $outer = 1) Get Html of the element. (required: #include <Sciter-UDF.au3>) _StSetElementHtml ($el, $html, $where) Set inner or outer html of the element. (required: #include <Sciter-UDF.au3>) _StGetElementText ($el) Get inner text of the element (required: #include <Sciter-UDF.au3>) _StSetElementText ($el, $String) Set inner text of the element. (required: #include <Sciter-UDF.au3>) _StGetChildrenCount ($el) Get number of child elements. (required: #include <Sciter-UDF.au3>) _StGetFocusElement ($hwnd) Get focused DOM element of HTML document. (required: #include <Sciter-UDF.au3>) _StGetElementState ($el) Get state bits, see ELEMENT_STATE_BITS in "Sciter-constants.au3" (required: #include <Sciter-UDF.au3>) _StSetElementState ($el, $stateToSet, $stateToClear = 0, $upt = 1) Set state bits, see ELEMENT_STATE_BITS in "Sciter-constants.au3" (required: #include <Sciter-UDF.au3>) _StGetNthChild ($el, $nth) Get handle of Nth child element. (required: #include <Sciter-UDF.au3>) _StGetParentElement ($el) Get parent element. (required: #include <Sciter-UDF.au3>) _StGetAttributeCount ($el) Get number of element's attributes. (required: #include <Sciter-UDF.au3>) _StGetNthAttribute ($el, $nth) Get value of any element's attribute by attribute's number. (required: #include <Sciter-UDF.au3>) _StGetAttributeByName ($el, $AttName) Get value of any element's attribute by name. (required: #include <Sciter-UDF.au3>) _StSetAttributeByName ($el, $AttName, $value) Set attribute's value. (required: #include <Sciter-UDF.au3>) _StClearAttributes ($el) Remove all attributes from the element. (required: #include <Sciter-UDF.au3>) _StGetElementIndex ($el) Get element index. (required: #include <Sciter-UDF.au3>) _StGetElementType ($el) Get element's type. (required: #include <Sciter-UDF.au3>) _StGetStyleAttribute ($el, $StyleName) Get element's style attribute. (required: #include <Sciter-UDF.au3>) _StSetStyleAttribute ($el, $StyleName, $StyleValue) Set element's style attribute. (required: #include <Sciter-UDF.au3>) _StCreateElement ($tag, $txt = "") Create new element, the element is disconnected initially from the DOM. (required: #include <Sciter-UDF.au3>) _StInsertElement ($el, $elparent, $index) Insert element at index position of parent. (required: #include <Sciter-UDF.au3>) _StSelectElements ($el, $CssSel) Return Array of elements in a DOM that meets specified CSS selectors. (required: #include <Sciter-UDF.au3>) _StSelectParent ($el, $CssSel, $depth = 0) Find parent of the element by CSS selector. (required: #include <Sciter-UDF.au3>) _StDeleteElement ($el) Delete element. (required: #include <Sciter-UDF.au3>) _StWindowAttachEventHandler ($hwnd, $func, $events) Attach/Detach ElementEventProc to the Sciter window. (required: #include <Sciter-UDF.au3>)Sciter-UDF.7z
  13. Sorry i don't understand what you want you can use accesskeys behavior for give focus, see html_samples\behaviors\accesskeys.htm in sdk. you can also use csss, see html_samples\csss!\keyboard-handling.htm. for receiving key event try _HLWindowAttachEventHandler($HLHwnd, "_events", $HANDLE_KEY ) i actualy work on sciter udf (sciter is htmlayout + tiscript), sciter is up to date and correct some bug i have with opacity background. when i finish i will make an transparent osd menu exemple.
  14. no, but why you want use javascript ?
  15. try to download dll again, else try this code : #include <HtmLayout UDF.au3> msgbox(0,"",_HLStartup()) it must be shown 1 if dll is open.
  16. sorry, i've just test and the dll must be in scriptdir, test with all file in the same dir (don't forget layout.htm)
  17. dll must be in the same dir that HtmLayout UDF.au3 if you use exemple, else you can use _HLStartup($pathToDll)
  18. _HLWindowAttachEventHandler($HLHwnd, "_events", $HANDLE_BEHAVIOR_EVENT+$HANDLE_MOUSE) trigger behavior event and mouse event, first parameter of _events function is the event triggered ($HANDLE_MOUSE if you click on htmlayout) Each event are different parameter _HLGetParam get an array of parameter, see header of _HLGetParam for see array return. _HLWindowAttachEventHandler($HLHwnd, "_events", $HANDLE_BEHAVIOR_EVENT+$HANDLE_MOUSE) Func _events($ev, $prm) If $ev = $HANDLE_MOUSE Then $ad = _HLGetParam($ev,$prm) ConsoleWrite("MOUSE_EVENTS: "&$ad[0]&@CRLF) ConsoleWrite("X pos: "&$ad[2]&@CRLF) ConsoleWrite("Y pos: "&$ad[3]&@CRLF) EndIf If $ev = $HANDLE_BEHAVIOR_EVENT Then $ad = _HLGetParam($ev,$prm) If $ad[0] = $HYPERLINK_CLICK Then $href = _HLGetAttributeByName($ad[1], "href") If $href = "close" Then Exit EndIf EndIf EndFunc For get name tag of element triggered try _HLGetElementType($el) for get id attribute _HLGetAttributeByName($el, "id") for set css : _HLSetStyleAttribute ($el, $StyleName, $StyleValue) sorry, i'hve corrected.
  19. I finally managed to run HtmLayout.dll, HtmLayout is a fast, lightweight and embeddable HTML/CSS renderer and layout manager component. Download dll here : http://www.terrainformatica.com/htmlayout/HTMLayoutDLL.zip #include <WinAPI.au3> #include <WindowsConstants.au3> #include <HtmLayout Constants.au3> #include-once Global $aHLelementsfound = 0 Global $HtmLayoutdll = 0 Global $HtmLayoutRef = 0 Global $HandleWindowsAttachEvent = 0 Global $HtmLayoutEvHandler = 0 Global $aHLDOM_error[7] $aHLDOM_error[0] = "function completed successfully" $aHLDOM_error[1] = "invalid HWND" $aHLDOM_error[2] = "invalid HELEMENT" $aHLDOM_error[3] = "attempt to use HELEMENT which is not marked by HTMLayout_UseElement()" $aHLDOM_error[4] = "parameter is invalid, e.g. pointer is null" $aHLDOM_error[5] = "operation failed, e.g. invalid html in HTMLayoutSetElementHtml()" $aHLDOM_error[6] = "Dllcall error" ; #FUNCTION# ==================================================================================================== ; Name...........: _HLStartup ; Description....: Initialize HtmLayout ; Syntax.........: _HLStartup($dll = "HtmLayout.dll") ; Parameters.....: $dll - Path to HtmLayout DLL [Optional] ; ; Return values..: Success - 1 ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _HLStartup($dll = "HtmLayout.dll") $HtmLayoutRef += 1 If $HtmLayoutRef > 1 Then Return 1 $HtmLayoutdll = DllOpen($dll) If $HtmLayoutdll = -1 Then Return SetError(1, 0, 0) Return 1 EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _HLCreateGui ; Description....: Create HtmLayout Windows ; Syntax.........: _HLCreateGui($ParentGui, $x = 0, $y = 0, $w = 100, $h = 50) ; Parameters.....: $ParentGui - Handle of parent Gui ; $x - [Optional] ; $y - [Optional] ; $w - [Optional] ; $h - [Optional] ; ; Return values..: Success - HTMLayout window handle. ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _HLCreateGui($ParentGui, $x = 0, $y = 0, $w = 100, $h = 50) $result = DllCall($HtmLayoutdll, "wstr", "HTMLayoutClassNameW") If @error Then Return 0 $ClassName = $result[0] $HtmLayoutHwnd = _WinAPI_CreateWindowEx(0, $ClassName, "", BitOR($WS_CHILD, $WS_VISIBLE, $WS_CLIPCHILDREN), $x, $y, $w, $h, $ParentGui) Return $HtmLayoutHwnd EndFunc ;==>_HLCreateGui ; #FUNCTION# ==================================================================================================== ; Name...........: _HLLoadFile ; Description....: Load HTML file. ; Syntax.........: _HLLoadFile($HLHwnd, $file) ; Parameters.....: $HLHwnd - HTMLayout window handle. ; $file - File name of an HTML file. ; ; Return values..: Success - 1 ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _HLLoadFile($HLHwnd, $file) $result = DllCall($HtmLayoutdll, "BOOL", "HTMLayoutLoadFile", "HWND", $HLHwnd, "wstr", $file) Return $result[0] EndFunc ;==>_HLLoadFile ; #FUNCTION# ==================================================================================================== ; Name...........: _HLLoadHtml ; Description....: Load HTML from memory. ; Syntax.........: _HLLoadHtml($HLHwnd, $String) ; Parameters.....: $HLHwnd - HTMLayout window handle. ; $String - HTML to load. ; ; Return values..: Success - 1 ; Failure - 0 ; Remarks........: ; =============================================================================================================== Func _HLLoadHtml($HLHwnd, $String) $StringSize = StringLen($String) $result = DllCall($HtmLayoutdll, "BOOL", "HTMLayoutLoadHtml", "HWND", $HLHwnd, "str", $String, "UINT", $StringSize) Return $result[0] EndFunc ;==>_HLLoadHtml ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetRootElement ; Description....: Get root DOM element of HTML document. ; Syntax.........: _HLGetRootElement($HLHwnd) ; Parameters.....: $HLHwnd - HTMLayout window handle. ; ; Return values..: Success - Return root element. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: Root DOM object is always a 'HTML' element of the document. ; =============================================================================================================== Func _HLGetRootElement($HLHwnd) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetRootElement", "HWND", $HLHwnd, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetRootElement ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetChildrenCount ; Description....: Get number of child elements. ; Syntax.........: _HLGetChildrenCount($el) ; Parameters.....: $el - DOM element handle which child elements you need to count ; ; Return values..: Success - Return number of child elements ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetChildrenCount($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetChildrenCount", "ptr", $el, "UINT*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetChildrenCount ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetNthChild ; Description....: Get handle of Nth child element. ; Syntax.........: _HLGetNthChild($el, $nth) ; Parameters.....: $el - DOM element handle ; $nth - number of the child element ; ; Return values..: Success - Return handle of the child element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetNthChild($el, $nth) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetNthChild", "ptr", $el, "UINT", $nth-1, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[3] EndFunc ;==>_HLGetNthChild ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetParentElement ; Description....: Get parent element. ; Syntax.........: _HLGetParentElement($el) ; Parameters.....: $el - DOM element handle which parent you need ; ; Return values..: Success - Return handle of the parent element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetParentElement($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetParentElement", "ptr", $el, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetParentElement ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetElementHtml ; Description....: Get Html of the element. ; Syntax.........: _HLGetElementHtml($el, $outer = 1) ; Parameters.....: $el - DOM element handle ; $outer - BOOL, if TRUE will return outer HTML otherwise inner. [Optional] ; ; Return values..: Success - Return Html of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetElementHtml($el, $outer = 1) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetElementHtml", "ptr", $el, "str*", "", "BOOL", $outer) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetElementHtml ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetElementInnerText ; Description....: Get inner text of the element. ; Syntax.........: _HLGetElementInnerText($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return innertext of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetElementInnerText($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetElementInnerText", "ptr", $el, "str*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetElementInnerText ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSetElementInnerText ; Description....: Set inner text of the element. ; Syntax.........: _HLSetElementInnerText($el, $String) ; Parameters.....: $el - DOM element handle ; $String - Innertext ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLSetElementInnerText($el, $String) $len = StringLen($String) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSetElementInnerText", "ptr", $el, "str", $String, "UINT", $len) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLSetElementInnerText ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetAttributeCount ; Description....: Get number of element's attributes. ; Syntax.........: _HLGetAttributeCount($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return number of element attributes. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetAttributeCount($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetAttributeCount", "ptr", $el, "UINT*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetAttributeCount ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetNthAttribute ; Description....: Get value of any element's attribute by attribute's number. ; Syntax.........: _HLGetNthAttribute($el, $nth) ; Parameters.....: $el - DOM element handle ; $nth - number of desired attribute ; ; Return values..: Success - Return Array with name and value of attribute. $return[0] = name, $return[1] = value ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetNthAttribute($el, $nth) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetNthAttribute", "ptr", $el, "UINT", $nth, "str*", "", "wstr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Dim $aRet[2] $aRet[0] = $result[3] $aRet[1] = $result[4] Return $aRet EndFunc ;==>_HLGetNthAttribute ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetAttributeByName ; Description....: Get value of any element's attribute by name. ; Syntax.........: _HLGetAttributeByName($el, $AttName) ; Parameters.....: $el - DOM element handle ; $AttName - attribute name ; ; Return values..: Success - Return attribute value ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetAttributeByName($el, $AttName) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetAttributeByName", "ptr", $el, "str", $AttName, "wstr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[3] EndFunc ;==>_HLGetAttributeByName ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSetAttributeByName ; Description....: Set attribute's value. ; Syntax.........: _HLSetAttributeByName($el, $AttName, $value) ; Parameters.....: $el - DOM element handle ; $AttName - attribute name ; $value - new attribute value or 0 if you want to remove attribute. ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLSetAttributeByName($el, $AttName, $value) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSetAttributeByName", "ptr", $el, "str", $AttName, "wstr", $value) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLSetAttributeByName ; #FUNCTION# ==================================================================================================== ; Name...........: _HLClearAttributes ; Description....: Remove all attributes from the element. ; Syntax.........: _HLClearAttributes($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLClearAttributes($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutClearAttributes", "ptr", $el) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLClearAttributes ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetElementIndex ; Description....: Get element index. ; Syntax.........: _HLGetElementIndex($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return index of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetElementIndex($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetElementIndex", "ptr", $el, "UINT*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetElementIndex ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetElementType ; Description....: Get element's type. ; Syntax.........: _HLGetElementType($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return Type of element ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetElementType($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetElementType", "ptr", $el, "str*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[2] EndFunc ;==>_HLGetElementType ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetStyleAttribute ; Description....: Get element's style attribute. ; Syntax.........: _HLGetStyleAttribute($el, $StyleName) ; Parameters.....: $el - DOM element handle ; $StyleName - name of the style attribute ; ; Return values..: Success - Return value of the style attribute. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLGetStyleAttribute($el, $StyleName) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutGetStyleAttribute", "ptr", $el, "wstr", $StyleName, "wstr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[3] EndFunc ;==>_HLGetStyleAttribute ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSetStyleAttribute ; Description....: Set element's style attribute. ; Syntax.........: _HLSetStyleAttribute($el, $StyleName, $StyleValue) ; Parameters.....: $el - DOM element handle ; $StyleName - name of the style attribute ; $StyleValue - value of the style attribute. ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLSetStyleAttribute($el, $StyleName, $StyleValue) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSetStyleAttribute", "ptr", $el, "str", $StyleName, "wstr", $StyleValue) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLSetStyleAttribute ; #FUNCTION# ==================================================================================================== ; Name...........: _HLVisitElements ; Description....: Return Array of elements in a DOM that meets specified criteria. ; Syntax.........: _HLVisitElements($el, $TagName = "", $AttributeName = "", $AttributeValue = "", $depth = 0) ; Parameters.....: $el - DOM element handle ; $TagName - comma separated list of tag names to search, e.g. "div", "p", "div,p" etc. [Optional] ; $AttributeName - name of attribute, can contain wildcard characters. [Optional] ; $AttributeValue - value of attribute, can contain wildcard characters.[Optional] ; $depth - 0 means all descendants, 1 - direct children only, 2 - children and their children and so on. [Optional] ; ; Return values..: Success - Return array of element, $return[0] : number of element. ; Failure - Return 0 if no element found else Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLVisitElements($el, $TagName = "", $AttributeName = "", $AttributeValue = "", $depth = 0) $TagType = "str" $AttType = "str" $AttVType = "wstr" If $TagName = "" Then $TagType = "ptr" If $AttributeName = "" Then $AttType = "ptr" If $AttributeValue = "" Then $AttVType = "ptr" $handle = DllCallbackRegister("_HLElementsCallback", "BOOL", "ptr;ptr") Dim $aHLelementsfound[1] $result = DllCall($HtmLayoutdll, "int", "HTMLayoutVisitElements", "ptr", $el, $TagType, $TagName, $AttType, $AttributeName, $AttVType, $AttributeValue, "ptr", DllCallbackGetPtr($handle), "ptr", "", "DWORD", $depth) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) DllCallbackFree($handle) $HLelementsCount = UBound($aHLelementsfound) If $HLelementsCount = 1 Then Return 0 $aHLelementsfound[0] = $HLelementsCount-1 Return $aHLelementsfound EndFunc ;==>_HLVisitElements Func _HLElementsCallback($el, $param) Local $iUBound = UBound($aHLelementsfound) ReDim $aHLelementsfound[$iUBound + 1] $aHLelementsfound[$iUBound] = $el EndFunc ;==>_HLElementsCallback ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSelectElements ; Description....: Return Array of elements in a DOM that meets specified CSS selectors. ; Syntax.........: _HLSelectElements($el, $CssSel) ; Parameters.....: $el - DOM element handle ; $CssSel - comma separated list of CSS selectors, e.g.: div, id, div[align="right"]. ; ; Return values..: Success - Return Array of elements, $return[0] : number of element. ; Failure - Return 0 if no element found else Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: See list of supported selectors: http://terrainformatica.com/htmlayout/selectors.whtm ; =============================================================================================================== Func _HLSelectElements($el, $CssSel) $handle = DllCallbackRegister("_HLElementsCallback", "BOOL", "ptr;ptr") Dim $aHLelementsfound[1] $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSelectElements", "ptr", $el, "str", $CssSel, "ptr", DllCallbackGetPtr($handle), "ptr", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) DllCallbackFree($handle) $HLelementsCount = UBound($aHLelementsfound) If $HLelementsCount = 1 Then Return 0 $aHLelementsfound[0] = $HLelementsCount-1 Return $aHLelementsfound EndFunc ;==>_HLSelectElements ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSelectParent ; Description....: Find parent of the element by CSS selector. ; Syntax.........: _HLSelectParent($el, $CssSel, $depth = 0) ; Parameters.....: $el - DOM element handle ; $CssSel - comma separated list of CSS selectors, e.g.: div, id, div[align="right"]. ; $depth - if depth == 1 then it will test only element itself. ; Use depth = 1 if you just want to test he element for matching given CSS selector(s). ; depth = 0 will scan the whole child parent chain up to the root. [Optional] ; ; Return values..: Success - Return parent of the element. ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: ; =============================================================================================================== Func _HLSelectParent($el, $CssSel, $depth = 0) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSelectParent", "ptr", $el, "str", $CssSel, "UINT", $depth, "ptr*", "") If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return $result[4] EndFunc ;==>_HLSelectParent ; #FUNCTION# ==================================================================================================== ; Name...........: _HLSetElementHtml ; Description....: Set inner or outer html of the element. ; Syntax.........: _HLSetElementHtml($el, $html, $where) ; Parameters.....: $el - DOM element handle ; $html - string containing html text ; $where - possible values are: ; 0: replace content of the element ; 1: insert html before first child of the element ; 2: insert html after last child of the element ; 3: replace element by html, a.k.a. element.outerHtml = "something" ; 4: insert html before the element ; 5: insert html after the element ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: Value 3,4 and 5 for $where do not work for inline elements like ; =============================================================================================================== Func _HLSetElementHtml($el, $html, $where) $htmllen = StringLen($html) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutSetElementHtml", "ptr", $el, "str", $html, "DWORD", $htmllen, "UINT", $where) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLSetElementHtml ; #FUNCTION# ==================================================================================================== ; Name...........: _HLDeleteElement ; Description....: Delete element. ; Syntax.........: _HLDeleteElement($el) ; Parameters.....: $el - DOM element handle ; ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: After call to this function $el will become invalid. ; =============================================================================================================== Func _HLDeleteElement($el) $result = DllCall($HtmLayoutdll, "int", "HTMLayoutDeleteElement", "ptr", $el) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) Return 1 EndFunc ;==>_HLDeleteElement ;~ EXTERN_C HLDOM_RESULT HLAPI HTMLayoutShowPopup (HELEMENT hePopup, HELEMENT heAnchor, UINT placement) ;~ Shows block element (DIV) in popup window. ;~ Func _HLShowPopup($HtmLayoutdll, $el, $anchor, $placement) ;~ $result = DllCall($HtmLayoutdll, "int", "HTMLayoutShowPopup", "ptr", $el, "ptr", $anchor, "UINT", $placement) ;~ If @error Then Return 0 ;~ Return 1 ;~ EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _HLWindowAttachEventHandler ; Description....: Attach/Detach ElementEventProc to the htmlayout window. ; Syntax.........: _HLWindowAttachEventHandler($hwnd, $func) ; Parameters.....: $hwnd - HWND of HtmLayout windows ; $func - Function to receive events (need two params eg: $func($ev, $prm) ; $events - Events you want receive (see remarks) ; Return values..: Success - Return 1 ; Failure - Return -1, @error is set. (see $aHLDOM_error[@error] for details) ; Remarks........: _HLGetParam must use for read param of event. ;~ Events can be : ;~ $HANDLE_INITIALIZATION : attached/detached ;~ $HANDLE_MOUSE : mouse events ;~ $HANDLE_KEY : key events ;~ $HANDLE_FOCUS : focus events, if this flag is set it also means that element it attached to is focusable ;~ $HANDLE_SCROLL : scroll events ;~ $HANDLE_SIZE : size changed event ;~ $HANDLE_DATA_ARRIVED : requested data () has been delivered ;~ $HANDLE_BEHAVIOR_EVENT : secondary, synthetic events: ;~ BUTTON_CLICK, HYPERLINK_CLICK, etc., ;~ a.k.a. notifications from intrinsic behaviors ;~ $HANDLE_METHOD_CALL : behavior specific methods ;~ $HANDLE_EXCHANGE : system drag-n-drop events ;~ $HANDLE_ALL : all of them ; =============================================================================================================== Func _HLWindowAttachEventHandler($hwnd, $func, $events) $HandleWindowsAttachEvent = DllCallbackRegister("HLEvHandler", "BOOL", "ptr;ptr;UINT;ptr") $result = DllCall($HtmLayoutdll, "int", "HTMLayoutWindowAttachEventHandler", "HWND", $hwnd, "ptr", DllCallbackGetPtr($HandleWindowsAttachEvent), "ptr", "", "UINT", $DISABLE_INITIALIZATION+$events) If @error Then Return SetError(6,0,-1) If $result[0] <> 0 Then SetError($result[0],0,-1) $HtmLayoutEvHandler = $func Return 1 EndFunc ;==>_HLWindowAttachEventHandler Func HLEvHandler($tag,$el,$ev,$prm) $a = DllStructCreate("UINT cmd", $prm) $cmd = DllStructGetData($a, "cmd") $a = 0 If $cmd > 32768 Then Return Execute ($HtmLayoutEvHandler&"("&$ev&","&$prm&")") EndFunc ; #FUNCTION# ==================================================================================================== ; Name...........: _HLGetParam ; Description....: Get parameter of events ; Syntax.........: _HLGetParam($ev, $prm) ; Parameters.....: $ev - Type of event see remarks of _HLWindowAttachEventHandler ; $prm - Parameter of event ; ; Return values..: Success - return an array depending of event ; Failure - Return -1 ; Remarks........: For Uppercase type see "HtmLayout Constants.au3" ; $HANDLE_MOUSE : $ret[12]=[MOUSE_EVENTS, target el, curs xpos el rel, curs ypos el rel, curs xpos doc rel, curs ypos doc rel, MOUSE_BUTTONS, KEYBOARD_STATES, CURSOR_TYPE, is on icon, el dragged, DRAGGING_TYPE] ; $HANDLE_KEY : $ret[4]=[KEY_EVENTS, target el, key code, KEYBOARD_STATES] ; $HANDLE_FOCUS : $ret[4]=[FOCUS_EVENTS, target el, focus by click, cancel] ; $HANDLE_SCROLL: $ret[4]=[SCROLL_EVENTS, target el, scroll pos, 1 if vert scroll] ; $HANDLE_BEHAVIOR_EVENT : $ret[5]=[BEHAVIOR_EVENTS, target el, source el, EVENT_REASON or EDIT_CHANGED_REASON, data] ;=============================================================================================================== Func _HLGetParam($ev, $prm) Local $ap = -1 If $ev = $HANDLE_MOUSE Then $str = "UINT cmd;ptr target;DWORD posx;DWORD posy;DWORD pos_documentx;DWORD pos_documenty;UINT button_state;UINT alt_state;UINT cursor_type;BOOL is_on_icon;ptr dragging;UINT dragging_mode" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_KEY Then $str = "UINT cmd;ptr target;UINT key_code;UINT alt_state" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_FOCUS Then $str = "UINT cmd;ptr target;BOOL by_mouse_click;BOOL cancel" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_SCROLL Then $str = "UINT cmd;ptr target;int pos;BOOL vertical" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_BEHAVIOR_EVENT Then $str = "UINT cmd;ptr heTarget;ptr he;UINT reason;ptr data" $ap = getstructdata($str,$prm) EndIf If $ev = $HANDLE_METHOD_CALL Then $str = "UINT cmd;ptr heTarget;ptr he;UINT reason;ptr data" $ap = getstructdata($str,$prm) EndIf Return $ap EndFunc Func getstructdata($str,$prm) $a = DllStructCreate($str, $prm) $b = StringSplit ( $str, ";") Dim $ret[$b[0]] For $i = 0 To $b[0]-1 $ret[$i] = DllStructGetData($a,$i+1) Next Return $ret EndFunc Edit: add some function. User calltips : _HLStartup ($dll = "HtmLayout.dll") Initialize HtmLayout (required: #include <HtmLayout UDF.au3>) _HLCreateGui ($ParentGui, $x = 0, $y = 0, $w = 100, $h = 50) Create HtmLayout Windows (required: #include <HtmLayout UDF.au3>) _HLLoadFile ($HLHwnd, $file) Load HTML file. (required: #include <HtmLayout UDF.au3>) _HLLoadHtml ($HLHwnd, $String) Load HTML from memory. (required: #include <HtmLayout UDF.au3>) _HLGetRootElement ($HLHwnd) Get root DOM element of HTML document. (required: #include <HtmLayout UDF.au3>) _HLGetChildrenCount ($el) Get number of child elements. (required: #include <HtmLayout UDF.au3>) _HLGetGetFocusElement ($hwnd) Get focused DOM element of HTML document. (required: #include <HtmLayout UDF.au3>) _HLGetGetElementState ($el) Get state bits, see ELEMENT_STATE_BITS in "HtmLayout constats.au3" (required: #include <HtmLayout UDF.au3>) _HLSetElementState ($el, $stateToSet, $stateToClear = 0, $upt = 1) Set state bits, see ELEMENT_STATE_BITS in "HtmLayout constats.au3" (required: #include <HtmLayout UDF.au3>) _HLGetNthChild ($el, $nth) Get handle of Nth child element. (required: #include <HtmLayout UDF.au3>) _HLGetParentElement ($el) Get parent element. (required: #include <HtmLayout UDF.au3>) _HLGetElementHtml ($el, $outer = 1) Get Html of the element. (required: #include <HtmLayout UDF.au3>) _HLGetElementInnerText ($el) Get inner text of the element. (required: #include <HtmLayout UDF.au3>) _HLSetElementInnerText ($el, $String) Set inner text of the element. (required: #include <HtmLayout UDF.au3>) _HLGetAttributeCount ($el) Get number of element's attributes. (required: #include <HtmLayout UDF.au3>) _HLGetNthAttribute ($el, $nth) Get value of any element's attribute by attribute's number. (required: #include <HtmLayout UDF.au3>) _HLGetAttributeByName ($el, $AttName) Get value of any element's attribute by name. (required: #include <HtmLayout UDF.au3>) _HLSetAttributeByName ($el, $AttName, $value) Set attribute's value. (required: #include <HtmLayout UDF.au3>) _HLClearAttributes ($el) Remove all attributes from the element. (required: #include <HtmLayout UDF.au3>) _HLGetElementIndex ($el) Get element index. (required: #include <HtmLayout UDF.au3>) _HLGetElementType ($el) Get element's type. (required: #include <HtmLayout UDF.au3>) _HLGetStyleAttribute ($el, $StyleName) Get element's style attribute. (required: #include <HtmLayout UDF.au3>) _HLSetStyleAttribute ($el, $StyleName, $StyleValue) Set element's style attribute. (required: #include <HtmLayout UDF.au3>) _HLVisitElements ($el, $TagName = "", $AttributeName = "", $AttributeValue = "", $depth = 0) Return Array of elements in a DOM that meets specified criteria. (required: #include <HtmLayout UDF.au3>) _HLSelectElements ($el, $CssSel) Return Array of elements in a DOM that meets specified CSS selectors. (required: #include <HtmLayout UDF.au3>) _HLSelectParent ($el, $CssSel, $depth = 0) Find parent of the element by CSS selector. (required: #include <HtmLayout UDF.au3>) _HLSetElementHtml ($el, $html, $where) Set inner or outer html of the element. (required: #include <HtmLayout UDF.au3>) _HLDeleteElement ($el) Delete element. (required: #include <HtmLayout UDF.au3>) _HLWindowAttachEventHandler ($hwnd, $func) Attach/Detach ElementEventProc to the htmlayout window. (required: #include <HtmLayout UDF.au3>) _HLGetParam ($ev, $prm) Get parameter of events (required: #include <HtmLayout UDF.au3>)HtmLayout UDF.7z
  20. You can use open source software like 7zip (exe is bigger than winrar, archive is smaller) AutoItObject_v1.0.0.exe AutoItObject_v1.0.0.7z
  21. i don't know, all my test are failed. sorry
  22. i don't know why memory up, i try vb example and it do same. Events increase memory too. perhaps solution is delete and create object for each htm file change.
  23. you can use $obj.Load or read file in string and Loadhtml string. i use this for testing : Case $GUI_EVENT_SECONDARYUP $Obj1.Load('file://'&@scriptdir&'\Layout.htm') Right click on gui reload the file.
  24. Why refresh a gui ? if refresh exist, it's refrech nothing : $obj.LoadHtml('<html><body><h1 id="ex">test</h1></body></html>') $obj.refresh does nothing if you want change h1 value you can try use $m = $obj.root.Select("#ex") and $m.Value = "change" else $obj.LoadHtml('<html><body><h1 id="ex">Change</h1></body></html>') i failed to use SelectAll HRESULT SelectAll([in] BSTR cssSelector, [out,retval] IElements** ppEls); = "Returns enumerable collection of all subelemts matching the selector" when i use for $el in $var autoit crash.
  25. for UDF, dll version of htmlayout is better (no need to register activex), but i don't know how to use dll. What fonction you search ? i can try to develop an exemple of what you need, but i can't explain you because i'm noob in com and object and i'm french (It's very difficult for me to express me correctly)
×
×
  • Create New...