Jump to content

ObjCreateInterface help: can't call IPinnedList3->Modify


Go to solution Solved by Nine,

Recommended Posts

Hi,

I'm using the portable version of AutoIt 3.3.16.0 on Windows 11 x64 22000.613 and I can't get this script to work:

#include <WinAPI.au3>
#include <WinAPISys.au3>
#include <WinAPIProc.au3>

PinShortcutToTaskbar("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Word.lnk")

Func PinShortcutToTaskbar($sPath)
    Local $oIPinnedList3 = ObjCreateInterface("{90AA3A4E-1CBA-4233-B8BB-535773D48449}", "{0DD79AE2-D156-45D4-9EEB-3B549769E940}", "d1 hresult();d2 hresult();d3 hresult();d4 hresult();d5 hresult();d6 hresult();d7 hresult();d8 hresult();d9 hresult();d10 hresult();d11 hresult();d12 hresult();d13 hresult();Modify hresult(ptr,ptr,uint);")

    Local $ppidl = DllCall("shell32.dll", "ptr", "ILCreateFromPathW", "wstr", $sPath)
    $oIPinnedList3.Modify(0, $ppidl[0], 4)
EndFunc

The error message shown is:
 

Quote

 

Line 24

$oIPinnedList3.Modify(0, $ppidl[0], 4)
$oIPinnedList3^ ERROR

Error: The requested action with this object has failed.

 

IsObj on $oIPinnedList3 returns 1. The actual method works: if I build the C++ program from https://geelaw.blog/entries/msedge-pins/ and run it, it pins Word to the taskbar, so I know the method still works on my Windows version.

The vtable is:

 

struct IPinnedList3Vtbl
{
    void* QueryInterface;
    void* AddRef;
    ReleaseFuncPtr* Release;
    void* MethodSlot4; void* MethodSlot5; void* MethodSlot6;
    void* MethodSlot7; void* MethodSlot8; void* MethodSlot9;
    void* MethodSlot10; void* MethodSlot11; void* MethodSlot12;
    void* MethodSlot13; void* MethodSlot14; void* MethodSlot15;
    void* MethodSlot16;
    ModifyFuncPtr* Modify;
};

 

I think I've counted correctly: in my definition of the interface in AutoIt, I've left out the IUnknown methods, counted 13 dummy pointers and made Modify the 14th in my AutoIt definition. I suspect I'm not pointing to the PIDL array properly, but I'm out of ideas. Thanks.

Link to comment
Share on other sites

  • Solution

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...