Replies: 5 comments
-
Hey @Arakula - thanks for the question! If you send a non-typed regular javascript array, what do you get in SaveImageAs? @david-risney Thoughts? |
Beta Was this translation helpful? Give feedback.
-
If I send an array, like so ...
I get a (VT_VARIANT | VT_ARRAY) with pArray->cDims=1 and rgsabound[0].cbElements=3. Each element comes in as a VT_I4. |
Beta Was this translation helpful? Give feedback.
-
Would you be able to use a regular array like that? Can you try adding another property onto the UInt8Array object (like arr.MyValue = "hello") and see if you can GetIDsOfNames for MyValue? I'm wondering if we are stripping out the built-in values from JS objects when we expose it as IDispatch. |
Beta Was this translation helpful? Give feedback.
-
We already got another circumvention in place - passing the image data as a base64-encoded string. That works, but is a bit suboptimal. If I add arr.MyValue = "hello" to the UInt8Array, then yes, I get the ID of MyValue; it's 1, indicating that there's not much else available. To rule out an alphasorted list, I also tried arr.AAA and arr.zzz, which came in with IDs 1 and 2. So, if you're stripping out the built-in values, and don't offer IDispatchEx or GetTypeInfoCount()/GetTypeInfo(), I'd be very interested in how the host side is supposed to determine what it received and what it can do with it. |
Beta Was this translation helpful? Give feedback.
-
For those using C#, type the array as an object[] |
Beta Was this translation helpful? Give feedback.
-
I am currently trying to pass a UInt8Array from JavaScript back to my program. The host object exposes the following method:
(not hard to see what it should do ...). The object is added to the WebView2 window using the name "ImgSave" - works nicely.
Okay, over to the JavaScript side ... distilled down, it does the following:
... and the host object method is called with ... something. While the file name comes in nicely, the "something" coming in as the arrayImage parameter is a VT_DISPATCH, and I can't find out what exactly is hidden behind that. I'm no COM expert, so I'm sorry if I'm missing the obvious here ... but:
How can I get to the data that should be passed in? Calling
pDisp->QueryInterface(IID_IDispatchEx, (void **)&pDispEx);
doesn't work,pDisp->GetTypeInfoCount(&tic);
doesn't work, usingpDisp->GetIDsOfNames(IID_NULL, pszArgs, _countof(pszArgs), LOCALE_USER_DEFAULT, dispIds);
doesn't work for anything I can think up (like "value", "name", "length", "buffer", "byteLength").So ... two questions:
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions