[webkit-dev] Webkit and Windows.Forms issue

John Penman (jopenman) jopenman at cisco.com
Thu Oct 2 12:15:10 PDT 2008


Hi all,

  I have been trying over the last few weeks with little success to
integrate Webkit into a VC2005 project that uses Windows.Forms for its
GUI.  I have successfully built the WinLauncher application that comes
with the WebKit package, but that project relies heavily on its
integration with the WebKit Solution.  After some work I was able to
build a version of WinLauncher outside the WebKit solution, but cannot
find a solution that will allow me to integrate into a Windows.Forms .h
file.  Since the VC2005 GUI designer creates it forms in .h files.

 

I am writing my app in C++/CLI mode (not C#).  Brief description:

 

I am trying to display the WebView in a Panel (contentPanel) on my Form:

 

                                IntPtr ptrHwnd = contentPanel->Handle;

                                HWND newHwnd =
(HWND)ptrHwnd.ToPointer();

                                                

                                pin_ptr<IWebView*> p = &gWebView;

                                HRESULT hr =
CoCreateInstance(CLSID_WebView, 0, CLSCTX_ALL, IID_IWebView, (void**)p);

                                if (FAILED(hr))

                                        goto exit;

 

                                gWebHost = new CPortalBrowserWebHost();

                                gWebHost->AddRef();

                                hr =
gWebView->setFrameLoadDelegate(gWebHost);

                                if (FAILED(hr))

                                        goto exit;

 

                                hr =
gWebView->setHostWindow((OLE_HANDLE) ptrHwnd.ToPointer());

                                if (FAILED(hr))

                                        goto exit;

 

                                RECT clientRect;

                                GetClientRect(newHwnd, &clientRect);

                                hr = gWebView->initWithFrame(clientRect,
0, 0);

                                if (FAILED(hr))

                                    goto exit;

 

It fails on the hr = gWebView->initWithFrame(clientRect, 0, 0); with an
error code of (-2147024882).

 

If anyone can help with this issue I would greatly appreciate it!

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.webkit.org/pipermail/webkit-dev/attachments/20081002/1d0e07a1/attachment.html 


More information about the webkit-dev mailing list