Jump to content

Hooking into the IDispatch interface.


monoceres
 Share

Recommended Posts

Hi, Larry!

Would the information in this topic be applicable to acheiving Task Scheduler task enumeration as shown in the link above?

They are going to come

into the IUnknown with AutoIt script.

Your ITaskScheduler inherites from IUnknown, too

interface ITaskScheduler : IUnknown
{
// Methods:
    HRESULT SetTargetComputer(
        [in] LPCWSTR pwszComputer);
    HRESULT GetTargetComputer(
        [out] LPWSTR * ppwszComputer);
    HRESULT Enum(
        [out] IEnumWorkItems **
            ppEnumWorkItems);
    HRESULT Activate(
        [in] LPCWSTR pwszName,
        [in] REFIID riid,
        [out] IUnknown ** ppUnk);
    HRESULT Delete(
        [in] LPCWSTR pwszName);
    HRESULT NewWorkItem(
        [in] LPCWSTR pwszTaskName,
        [in] REFCLSID rclsid,
        [in] REFIID riid,
        [out] IUnknown ** ppUnk);
    HRESULT AddWorkItem(
        [in] LPCWSTR pwszTaskName,
        [in] IScheduledWorkItem *
            pWorkItem);
    HRESULT IsOfType(
        [in] LPCWSTR pwszName,
        [in] REFIID riid);
}

The point of world view

Link to comment
Share on other sites

  • Replies 70
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Code for wrapping interfaces and accessing theirs methods like they were IDispatch's methods is written. No problems there.

What we have now as a problem regarding that is choosing syntax. For example ProgAndy prefers DllCallbackRegister() type of syntax and I would like DllStructCreate()/DllCall() look.

In case of latter you don't need to bother your self with types when initializing wrapper function but you call methods in this manner:

$oObject.SomeMethod("dword", 5, "ptr", $pPointer)

In case of former, call is this:

$oObject.SomeMethod(5, $pPointer)

But you would have to specify types when initializing:

Register($oObject, "SomeMethod", "dword", "dword;ptr", $iOrd)
Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Code for wrapping interfaces and accessing theirs methods like they were IDispatch's methods is written. No problems there.

What we have now as a problem regarding that is choosing syntax. For example ProgAndy prefers DllCallbackRegister() type of syntax and I would like DllStructCreate()/DllCall() look.

In case of latter you don't need to bother your self with types when initializing wrapper function but you call methods in this manner:

$oObject.SomeMethod("dword", 5, "ptr", $pPointer)

In case of former, call is this:

$oObject.SomeMethod(5, $pPointer)

But you would have to specify types when initializing:

Register($oObject, "SomeMethod", "dword", "dword;ptr", $iOrd)

If there were to be a vote then I would choose the former as you refer to it but the latter in your explanation. I would much rather put the small extra effort into specifying the types when the function is defined than have to specify them every time I call the function which could be many more times. Also, probably many udf's will be generated with this new capability and the user will hardly be concerned with initializing the functions but will have to call them, and the extra detail required will seem burdensome. I can see that with a dll call the variables need to be cast to the correct type but here you have the opportunity to protect the user from that requirement and one of the fundamental aims of AutoIt is to keep the language as simple as possible and thereby useable by as many as possible.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

If there were to be a vote then I would choose the former as you refer to it but the latter in your explanation. I would much rather put the small extra effort into specifying the types when the function is defined than have to specify them every time I call the function which could be many more times. Also, probably many udf's will be generated with this new capability and the user will hardly be concerned with initializing the functions but will have to call them, and the extra detail required will seem burdensome. I can see that with a dll call the variables need to be cast to the correct type but here you have the opportunity to protect the user from that requirement and one of the fundamental aims of AutoIt is to keep the language as simple as possible and thereby useable by as many as possible.

That's pretty much what others say too and what we'll be offering; seems. Also that makes me kinda alone in my thinking and it shows (to me, that is) that you don't think in AutoIt, but some other programming language.

I'll keep my right of disagreeing though. This is more DllCall() than it's everything else. Udfs would be written by people using AutoIt, not some microsoft developer whose job is to write wrappers for the new framework or shit. Rule of understanding calls and parameters that is pulled many times by AutoIt devs for using DllCall and related functions is applicable here too. Or at least should be.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

I am studying the code in this thread and was wondering if based on this code

a.I can create a variant variable.

b.Pass that variable as VT_BYREF

part a

Global Const $__Au3Obj_tagVARIANT = "ushort vt;ushort r1;ushort r2;ushort r3;ptr data; ptr"
Global $tVar = DllStructCreate($__Au3Obj_tagVARIANT)
Global $pVar = DllStructGetPtr($tVar)
__Au3Obj_VariantInit($pVar)

How can I do part b?

(Think) I need this to get this working

http://www.autoitscript.com/forum/index.php?showtopic=95176&st=0&p=772589&hl=oleacc&fromsearch=1&#entry772589

;~  This should work but doesn't
;~  $oIAccesible.accLocation($px,$py,$cx,$cy,$oChild)
;~ All kinds of workarounds not working
;~ Just to see if something is changed variables initialized
    dim $p[4]=[1,2,3,4]
    $px=1
    $pY=2
    $cX=3
    $cY=4

$tInfo = $tinfo & "call1" & ";" & @crlf
;~  $aRet1=$oIaccesible.acclocation()
    $aRet1= $oIAccesible.accLocation($p[0],$p[1],$p[2],$p[3],$oChild)
    $tInfo = $tinfo & "call2" & ";" & @crlf
    $aRet2=$oIAccesible.accLocation(DllStructGetPtr($i4Int,1) ,DllStructGetPtr($i4Int,2),DllStructGetPtr($i4Int,3),DllStructGetPtr($i4Int,4),$oChild) 
;~  $aRet2=$oIAccesible.accLocation(DllStructGetPtr($i4Int),$oChild) 
$tInfo = $tinfo & "call3" & ";" & @crlf
    $aRet3=$oIAccesible.accLocation($px ,$py,$cx,$cy,0)
Link to comment
Share on other sites

AutoIt doesn't support byref with IDispatch. You can't change this I think.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Yeah, when wrapping it like a non-IDispatch-Interace, ByRef is available. The thing is, he needs it for the function AccessibleObjectFromPoint and there it is possible since this is a normal DLL-function :mellow: Just wait until we release the UDFs, there are some better emthods for dealing with Variants.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

I don't think I've been this excited about AutoIt since the GUI functions were released. Monocres, you impress me every time you post. Can't wait for this to be released.

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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