PDM API get state icon

Hi everyone,

I am trying to get the icon of a PDM state, which should be possible according to this link:

https://help.solidworks.com/2024/english/api/epdmapi/epdm.interop.epdm~epdm.interop.epdm.iedmstate5~iconname.html?verRedirect=1

But I just don’t know how to extract the icon from that WfIcons.dll. I tried using ResHacker, but that does not find resources matching the names specified in the link.

Thanks for your help!

JJ

2 Answers

2

Are you trying to get the images dynamically? Or just to have as a resource?

If it’s just a resource, you can extract them from the WfIcons.dll using 7zip. To do so,
Select open archive on WfIcons.dll
Browse to .rsrc\1053\PNG
Select all the files you want to extract
Select the extract button and add them to a folder you select.
Next rename all the files with a png extension and now you have all the icons available.

Thx! I didn't know you could use 7zip for that. I used ResHacker, but found out that I could not find the names as specified in the link.

–

I could be wrong since I have tested this but I’d try to load the assembly using Assembly.Load and then use GetFile to get the binary stream of the file. Load that into a bitmap and save it as a png.

I tried to use the Assembly.Load, but immediately ran into an exception ({"The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)":null}). So I decided to use ResHacker to extract the images. This is how I found out they don't have a name as specified in the link.

–

You need to use LoadFrom

–