[webkit-dev] Win32 App

Jason Hullinger sshjason at gmail.com
Sun Sep 28 20:13:33 PDT 2008


In Cocoa I have made a command line application that init's a WebView, then
calls, stringByEvaluatingJavaScriptFromString, however, I'm trying to get
this to work in Windows. I've compiled WebKit and added a new Win32 command
line project, however, I'm always getting back "null" when calling
stringByEvaluatingJavaScriptFromString. Below is the source, and I've tried
a variety of different things to eval ("1 + 1", "var foo = 1", etc.), and
again, it's always null.

Thanks for any information,

~/Jason Hullinger

src snippet:


int _tmain(int argc, _TCHAR* argv[])

{

HRESULT hr;

hr = OleInitialize(NULL);

if(FAILED(hr)){

printf("failed to CoInit\n");

return -1;

}

IWebView *webView;

hr = CoCreateInstance(CLSID_WebView, 0, CLSCTX_ALL, IID_IWebView, (void
**)&webView);

if(FAILED(hr)){

printf("failed to create a webView\n");

return -1;

}

BSTR result = L"";

BSTR script = L"function hello(){ return 'hello'; } hello();";

webView->stringByEvaluatingJavaScriptFromString(script, &result);

printf("result: %S\nHit return to exit", result);

char temp[1024];

gets(temp);

return 0;

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.webkit.org/pipermail/webkit-dev/attachments/20080928/de2e04e4/attachment.html 


More information about the webkit-dev mailing list