Ontosy Posted April 16, 2016 Share Posted April 16, 2016 (edited) I have tryed to compile this "com object" and then use with AutoIt3 but not work: "err.number 0x80020006. How to do? #include-once Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local Const $sCLSID_TaskbarList = "{7233b105-bc01-41ff-b72e-582c5954b76d}" Local Const $sIID_ITaskbarList = "{702d63b3-d7d1-4f17-ab11-2f2ed770fdc8}" Local Const $sTagITaskbarList = 'SetString(wstr:cdecl);wstr:cdecl GetString();' Local $oIExample = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList, $sTagITaskbarList) $a=$oIExample.SetString("Abc") msgbox(0,@error,$a) $a=$oIExample.GetString() ;.GetRootElement.CurrentClassName exit msgbox(0,0,$a) Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc Edited April 16, 2016 by Ontosy mLipok 1 Link to comment Share on other sites More sharing options...
AutoBert Posted April 16, 2016 Share Posted April 16, 2016 Quote Warning: This feature is experimental. It may not work, may contain bugs or may be changed or removed without notice. DO NOT REPORT BUGS OR REQUEST NEW FEATURES FOR THIS FEATURE. Link to comment Share on other sites More sharing options...
Ontosy Posted April 16, 2016 Author Share Posted April 16, 2016 I not have reported "BUGS OR REQUEST NEW FEATURES FOR THIS FEATURE". I have asked for help in this regard. Link to comment Share on other sites More sharing options...
AutoBert Posted April 16, 2016 Share Posted April 16, 2016 (edited) But you read it may not work and this happens in your script and i (and much others too) don't have the com.object. So i can only ask have you regsitered the object. Edited April 16, 2016 by AutoBert Link to comment Share on other sites More sharing options...
Popular Post LarsJ Posted April 16, 2016 Popular Post Share Posted April 16, 2016 It's a nice little example you found there. You have to download, compile and run the C-code in the link. Then you create an object with ObjCreateInterface in this way: #include <WinAPIConstants.au3> Opt( "MustDeclareVars", 1 ) Global Const $sCLSID_Example = "{6899A2A3-405B-44d4-A415-E08CEE2A97CB}" Global Const $sIID_IExample = "{74666CAC-C2B1-4fa8-A049-97F3214802F0}" Global Const $dtag_IExample = _ "SetString hresult(str);" & _ "GetString hresult(str;int);" Example() Func Example() Local $oExample = ObjCreateInterface( $sCLSID_Example, $sIID_IExample, $dtag_IExample ) If Not IsObj( $oExample ) Then Return ConsoleWrite( "ObjCreateInterface ERR" & @CRLF ) ConsoleWrite( "ObjCreateInterface OK" & @CRLF ) If Not $oExample.SetString( "My grandmother could do that too" ) = $S_OK Then _ Return ConsoleWrite( "SetString method ERR" & @CRLF ) ConsoleWrite( "SetString method OK" & @CRLF ) Local $sStr1, $sStr2 = "is a cool coder" If Not $oExample.GetString( $sStr1, 16 ) = $S_OK Then _ Return ConsoleWrite( "GetString method ERR" & @CRLF ) ConsoleWrite( "GetString method OK" & @CRLF ) ConsoleWrite( $sStr1 & $sStr2 & @CRLF ) EndFunc #cs SciTE console: ObjCreateInterface OK SetString method OK GetString method OK My grandmother is a cool coder #ce Danyfirex, Ontosy, mLipok and 2 others 5 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Ontosy Posted April 17, 2016 Author Share Posted April 17, 2016 It works! ty Link to comment Share on other sites More sharing options...
LarsJ Posted April 18, 2016 Share Posted April 18, 2016 You are welcome. Great to see so much interest in this topic. There is a whole series of a total of 8 articles about COM objects. They are all named "Com in plain C, Part n", where n is 1 - 8. You can find the articles at codeproject.com. This guy Jeff Glatt seems to know what he is talking about, and he also knows how to explain it. In "Com in plain C, Part 2" the IDispatch interface is added to the object which make it possible to create the object in a scripting language. In AutoIt you can create the object with the ObjCreate command. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Ontosy Posted April 18, 2016 Author Share Posted April 18, 2016 I also have tryed to use ObjCreate but it not work. I thought maybe you need the ProgID Link to comment Share on other sites More sharing options...
LarsJ Posted April 18, 2016 Share Posted April 18, 2016 I think the ProdID is "IExample2.object". Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Ontosy Posted April 18, 2016 Author Share Posted April 18, 2016 Do "IExample8.object" include "IExample2.object" and all previuos? Link to comment Share on other sites More sharing options...
LarsJ Posted April 18, 2016 Share Posted April 18, 2016 I don't know. I skimmed through the articles relatively quickly. I have not looked at the code. But I'm almost sure that it'll all work. Also in AutoIt. The articles seem pretty convincing. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Tahir_Mirza Posted December 14, 2016 Share Posted December 14, 2016 I have question and it may be simple as I am new to UIAutomation. How do you find the $sIID_ITaskbarList? I wanted to know which tool or method is used to find it? ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList, $sTagITaskbarList) Link to comment Share on other sites More sharing options...
LarsJ Posted December 14, 2016 Share Posted December 14, 2016 The interface description strings are specific for AutoIt. This means that AutoIt programmers have created all the existing description strings themselves. There are created several hundred interface objects and there are created interface description strings for all these objects. If you're lucky a description string does already exists for the interface you need. Search the forums. If a description string does not exists for your interface, you have to create it yourself. You create the description string from information you find in C/C++ header files. For ITaskbarList interface you find the information in ShObjIdl.h included in Windows SDK. Before you start creating a description string you should compare existing description strings with information in header files. In that way you can figure out which AutoIt data types matches the C/C++ data types. And you can always ask questions in this forum. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
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