c.haslam Posted February 10, 2020 Share Posted February 10, 2020 (edited) Because I find Corel's DialogEditor to be inferior to what can be done in Koda, I have written a macro that generates PerfectScript dialog code from Koda. Koda's Picture Editor allows me to choose a .dll or .exe containing icons. I can them choose an icon number. My problem is with Icon: PerfectScript's DialogAddIcon() requires an icon name rather than an icon number. My solution is to have the macro run an AutoIt script: an excerpt: Local $a10Data = _WinAPI_EnumResourceNames($path, $RT_GROUP_ICON) $iconName = $a10Data[$iconNumber] $a10Data is a 1-d array. This works where icon numbers are strictly sequential, but not if they aren't. An example: Koda tells me that wmploc.dll has icon numbers 0 to 156, then 158. If the icon number is <= 156, the correct name is retrieved, but if the icon number is 157, the name of 158 is retrieved. So I need to get an array of icon numbers. How can I do this in AutoIt? Edited February 11, 2020 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
Nine Posted February 10, 2020 Share Posted February 10, 2020 Use negative number for ordinal and positive number for name ? Or use _ArraySearch () ? Not sure what exactly is your problem “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
c.haslam Posted February 10, 2020 Author Share Posted February 10, 2020 An example of what does work: Local $a10Data = _WinAPI_EnumResourceNames(@SystemDir & '\wmploc.DLL', $RT_GROUP_ICON) $a10Data is a 1-dimension array. ln Koda, I choose icon number 31. Picture Editor numbers are ref. zero. Koda generates Local $Icon1 = GUICtrlCreateIcon("C:\Windows\System32\wmploc.DLL", -32, 120, 72, 32, 32) GuiCreateIcon() numbers are ref. 1, so 32 not 31. $a10Data[32] is 610. icon names are, per Microsoft, strings. PerfectScript's DialogAddIcon() argument is "#610". When I look in Picture Editor, I see that there are icons for all numbers from 0 up to and including 32. So the element number in the array is the icon number. But, looking further in Picture Editor, there is a gap in the numbers: the numbers skip from 156 to 158. So if I wanted icon 158, the icon name (less the #) is in a10Data[157], not in a10Data[158] ! Some time back I spent a chunk of time figuring out the difference between icon numbers and icon names. One thing I learnt is that some icon names are alphabetic! Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
c.haslam Posted February 11, 2020 Author Share Posted February 11, 2020 I have found the solution to my problem. The array returned by _WinAPI_EnumResourceNames($path, $RT_GROUP_ICON) has an element for the complete range of icon numbers, even if Picture Editor shows that there is no icon for a particular icon number. Element numbers are icon numbers. For example, in the case of wmploc.dll, there are elements containing icon names for icon 156, 157 and 158 even though of these icon 157 exists but 156 and 158 do not. My question now is: how can I detect that an icon does not exist? Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard 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