From: Tom Robinson Date: 2004-07-13T08:12:24+09:00 Subject: Using Win32API to load an icon from .ico file Has anyone successfully managed to do this? I'm trying to write an app using vruby which adds icons to the systray. VRuby comes with an example of how to do this, which works, except it does not say how to load the icons you want from .ico files. Instead it just uses icons out of the user32.dll I think. This is the code it uses to load the icons: LoadIcon = Win32API.new("user32","LoadIcon","II","I") QUESTIONICON= LoadIcon.call(0,32514) That works fine, and QUESTIONICON can then be used to call create_trayicon, but I'm trying to do this: LoadIconA = Win32API.new("user32","LoadIcon",['I','P'],"I") FOOICON= LoadIconA.call(0,"myicon.ico") I think if you give a string as a second argument to the LoadIcon call in the user32.dll it'll try and load from a file, but I'm not 100% sure. The docs from MS say that LoadIcon is deprecated and you should use LoadImage but that's even more complicated from what I can tell. I've found a few examples on the web of people who've used LoadIcon to load from .ico files (I think), but none of them are in ruby. I'm not sure if I'm specifying the parameter types correctly using ['I','P'] for an integer and a string either. Anyway, it loads a blank icon at the moment so it isn't working. Anyone managed to accomplish this before? -- tom@alkali.spamfree.org remove 'spamfree.' to respond