3

I have a library for Haskell that can take an ordinary web application, run it on a local server, and then open up a window displaying that application using QtWebkit. The code to interface with Qt is very short. However, I would like to avoid the Qt overhead for Windows users.

It seems like the best approach would be to have an alternative to this QtWebkit-based C++ file that instead uses the MSHTML library on Windows. Unfortunately, I have almost no experience with Windows-specific libraries. It seems like I need to use the IWebBrowser2 interface, but that seems mostly speculative.

If someone can point me in the right direction on this, I would be much obliged. The final trick here is that it has to compile with MinGW. Not sure how much of a complication that is in this case.

Thanks

Jason Dagit
  • 13,684
  • 8
  • 33
  • 56
Michael Snoyman
  • 31,100
  • 3
  • 48
  • 77
  • Have a look at [this article](http://www.codeproject.com/KB/COM/cwebpage.aspx). The accompanying zip file has several examples and there are no dependencies on MFC or anything like that. Dealing with the OLE stuff manually seems fairly hairy though. – hammar May 26 '11 at 02:48
  • I did give that a shot, thanks. I wasn't able to get it to compile with MinGW. – Michael Snoyman May 26 '11 at 14:00
  • Did you see [this page](http://www.apitalk.com/windows-Programming/Creating-Web-Browser-Easily-In-C-With-Mingw-Gcc-Dev-Cplusplus.html)? The author got it to work on MinGW, but unfortunately there aren't many details, and the provided example does not include the whole source code so you can't see which headers he had to change, but you can at least see the linker options in the makefile. – hammar May 26 '11 at 19:52

1 Answers1

1

You can use hdirect to call the IWebBrowser2 interface from Haskell. It's messy to code against OLE/COM but it can do the job. Making a C binding to the interface is possible but if you need MinGW then it may actually be harder than a purely Haskell approach.

Jason Dagit
  • 13,684
  • 8
  • 33
  • 56