qwerty12 Posted April 15, 2022 Posted April 15, 2022 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.
Solution Nine Posted April 15, 2022 Solution Posted April 15, 2022 Parameters of a method are separated with ; not , qwerty12 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now