Add scripting to your application with Vbsedit !

IActiveScriptStringCompare::StrComp

 

Defines the string comparison method for the scripting engine.

HRESULT StrComp(
// The first string:
    [in] BSTR bszStr1,  
// The second string: 
    [in] BSTR bszStr2,  
// The result of the comparison:
    [out, retval] LONG* iRet 
);

bszStr1

The first string.

bszStr2

The second string.

iRet

The result of the comparison. 0 if bszStr1 and bszStr2are identical; -1 if bszStr1 < bszStr2; 1 if bszStr1 > bszStr2.

Returns one of the following values:

Return Value

Meaning

S_OK

Success.

E_INVALIDARG

An argument is not valid.

E_UNEXPECTED

The call was not expected (for example, the scripting engine has not yet been loaded or initialized).

This method is called every time that a string comparison is executed.

Example

The following example shows how to overload the string comparison function. Overloading is allowed when you use IActiveScriptProperty::SetProperty to set SCRIPTPROP_STRINGCOMPAREINSTANCE.

cpp_quote("// {58562769-ED52-42f7-8403-4963514E1F11}")
cpp_quote("DEFINE_GUID(IID_IActiveScriptStringCompare, 0x58562769, 
    0xED52, 0x42f7, 0x84, 0x03, 0x49, 0x63, 0x51, 0x4E, 0x1F, 0x11);")
cpp_quote("")

cpp_quote("#define SCRIPTPROP_INTEGERMODE              0x00003000")
cpp_quote("#define SCRIPTPROP_STRINGCOMPAREINSTANCE    0x00003001")
cpp_quote("")
interface IActiveScriptStringCompare;
[
         object,
         uuid(58562769-ED52-42f7-8403-4963514E1F11),
         pointer_default(unique)
]
interface IActiveScriptStringCompare : IUnknown
{
        // StrComp
									//     bszStr1: first string
									//     bszStr2: second string
									//     iRet: 0 if identical, -1 if bszStr1 < bszStr2, 1 if 
									//         bszStr1 > bszStr2
									//          
									//     Return values:
									//         S_OK: Success
									//         E_NOTIMPL: Not implemented
									//
        HRESULT StrComp(
                [in] BSTR bszStr1,
                [in] BSTR bszStr2,
                [out, retval] LONG* iRet
        );
}


Add VBScript and Javascript scripting
to your application with VbsEdit !



Download Now!

This package includes VbsEdit 32-bit and 64-bit.




Home  

Copyright © 2001-2024 adersοft