From: Michael Davis Date: 2002-04-16T01:27:39+09:00 Subject: Re: Displaying gif or jpg files using Win32API? Park Heesob wrote: > ----- Original Message ----- > From: "Michael Davis" > To: "ruby-talk ML" > Sent: Sunday, April 14, 2002 2:12 AM > Subject: Displaying gif or jpg files using Win32API? > > > >>Has anyone successfully displayed a gif or jpg using Win32API? Has >>anyone created a C extension for Ruby that will display a gif or jpg? I >>have been trying, unsuccessfully, to do this using various C++ and VB >>examples. >> > > > Hi, > > Here is one solution. > > require 'Win32API' > HlinkNavigateString = Win32API.new("urlmon","HlinkNavigateString",['P','P'],'L') > MultiByteToWideChar = Win32API.new("kernel32","MultiByteToWideChar",['L','L','P','L','P','L'],'L') > str = 'c:\Program Files\FlashGet\Skin\TestBk.jpg' > ostr = "\0" * 256 > MultiByteToWideChar.Call(0,0,str,str.length+1,ostr,128); > HlinkNavigateString.Call(0,ostr) > > It works on Windows XP. > > Park Heesob > This is a cool suggestion and it works great. However, this opens a new browser window for each image. I was hoping to embed the image in an exisiting window. -- Michael Davis Database Architect and Senior Software Engineer, Seva Inc. Email: mdavis@sevainc.com