|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Win32 AppIn 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;} _______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: Win32 App> 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. Can't you use the debugger and single-step the function? Perhaps it returns immediately due to some error or something like that. -- Ariya Hidayat (ariya.hidayat@...) Software Engineer, Qt Software, Nokia _______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: Win32 App(reply all this time)
Well, it looks like stringByEvaluatingJavaScriptFromString is calling: JSC::JSValue* scriptExecutionResult = coreFrame->loader()->executeScript(WebCore::String(script), true); The problem, I believe, is that coreFrame (an IWebFrame) is not set to a value because I'm not using an actual frame, or view of any kind. Does anyone know if there is a similar way as a Windows app to do the same as in Cocoa?
Thank much, ~/Jason Hullinger
On Mon, Sep 29, 2008 at 1:12 AM, Ariya Hidayat <ariya.hidayat@...> wrote:
_______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: Win32 AppOn Sep 29, 2008, at 12:58 PM, Jason Hullinger wrote:
-Adam
_______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: Win32 AppYes, I guess that is the nicety of Objective-C and message passing.
I have tried to use initWithFrame with just a RECT set to {0, 0, 0, 0}, but it fails. I believe this is because it's not a RECT from an actual window, which is actually what I'm trying to get around using. Would there be any other way to use WebKit's DOM parser without actually creating a new instance of window, and have access to the full browser DOM? I know I can eval JavaScript with base ECMAScript function's, but having a full browser DOM is what I'm trying to get. Thanks much, ~/Jason Hullinger On Tue, Sep 30, 2008 at 6:59 AM, Adam Roben <aroben@...> wrote:
_______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: Win32 AppOn Sep 30, 2008, at 6:59 AM, Adam Roben wrote: > On Sep 29, 2008, at 12:58 PM, Jason Hullinger wrote: > >> (reply all this time) >> >> Well, it looks like stringByEvaluatingJavaScriptFromString is >> calling: JSC::JSValue* scriptExecutionResult = coreFrame->loader()- >> >executeScript(WebCore::String(script), true); The problem, I >> believe, is that coreFrame (an IWebFrame) is not set to a value >> because I'm not using an actual frame, or view of any kind. Does >> anyone know if there is a similar way as a Windows app to do the >> same as in Cocoa? > > I think you may need to call IWebView::initWithFrame before > stringByEvaluatingJavaScriptFromString will work. I'm surprised that > isn't required on OS X as well. It works on the Mac because when you allocate a WebView using [[WebView alloc] init], the NSView implementation of -init will call into -initWithFrame:. If you *don't* call -init, you would need to call -initWithFrame: or -initWithFrame:frameName:groupName: on the WebView to initialize it before you could make use of it. - Mark _______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: Win32 AppSo it does seem possible to initWithFrame with some sort of default values I assume? I've tried to initWithFrame({0, 0, 0, 0}, L"", L""); (or a RECT with the same values) , but it fails at run time.
Thanks, ~/Jason Hullinger On Tue, Sep 30, 2008 at 1:44 PM, Mark Rowe <mrowe@...> wrote:
_______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
|
|
Re: Win32 AppOn Sep 30, 2008, at 1:48 PM, Jason Hullinger wrote:
How exactly does it fail? It's hard to know what is going wrong unless you provide more detailed information about the manner in which it is failing. - Mark
_______________________________________________ webkit-dev mailing list webkit-dev@... http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev |
| Free Forum Powered by Nabble | Forum Help |