Xulrunner/JavaXPCOM - 如何创建 imgIContainer 实例?
我正在尝试创建此答案的 Java-XPCOM 版本:
我能够通过下面列出的调用(剪贴板、 io,可转移),但我不能对图像容器执行相同的操作(上面链接的答案中的 container = {};)
nsIClipboard clipboard = (nsIClipboard) org.mozilla.xpcom.Mozilla.getInstance().getServiceManager().getService("8b5314ba-db01-11d2-96ce-0060b0fb9956", nsIClipboard.NS_ICLIPBOARD_IID);
nsIIOService io = (nsIIOService) org.mozilla.xpcom.Mozilla.getInstance().getServiceManager().getService("9ac9e770-18bc-11d3-9337-00104ba0fd40", nsIIOService.NS_IIOSERVICE_IID);
nsITransferable transferable = (nsITransferable)org.mozilla.xpcom.Mozilla.getInstance().getServiceManager().getService("8b5314bc-db01-11d2-96ce-0060b0fb9956", nsITransferable.NS_ITRANSFERABLE_IID);
我尝试使用 componentManager 和serviceManager,但运气不好..
imgIContainer imgContainer = (imgIContainer)org.mozilla.xpcom.Mozilla.getInstance().getComponentManager().createInstance("5e04ec5e-1dd2-11b2-8fda-c4db5fb666e0", null, imgIContainer.IMGICONTAINER_IID);
是我的类 ID 错误,还是我应该以完全不同的方式执行这一切?
谢谢普拉杜姆纳
I am trying to create a Java-XPCOM version of this answer:
xul/xpcom copy image from string to clipboard
I am able to get hold of most of the services/components via calls such as these listed below (clipboard, io, transferable), but I can't do the same with the image container (container = {}; in the linked answer above)
nsIClipboard clipboard = (nsIClipboard) org.mozilla.xpcom.Mozilla.getInstance().getServiceManager().getService("8b5314ba-db01-11d2-96ce-0060b0fb9956", nsIClipboard.NS_ICLIPBOARD_IID);
nsIIOService io = (nsIIOService) org.mozilla.xpcom.Mozilla.getInstance().getServiceManager().getService("9ac9e770-18bc-11d3-9337-00104ba0fd40", nsIIOService.NS_IIOSERVICE_IID);
nsITransferable transferable = (nsITransferable)org.mozilla.xpcom.Mozilla.getInstance().getServiceManager().getService("8b5314bc-db01-11d2-96ce-0060b0fb9956", nsITransferable.NS_ITRANSFERABLE_IID);
I tried making an array of imgIContainers using both the componentManager as well as the serviceManager, but no luck..
imgIContainer imgContainer = (imgIContainer)org.mozilla.xpcom.Mozilla.getInstance().getComponentManager().createInstance("5e04ec5e-1dd2-11b2-8fda-c4db5fb666e0", null, imgIContainer.IMGICONTAINER_IID);
Is it that my Class ID is wrong, or should I be doing this all in a totally different way?
Thank you
Pradyumna
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现@mozilla.org/image/container;1的类ID是27f0682c-ff64-4dd2-ae7a-668e59f2fd38,而不是我错误使用的5e04ec5e-1dd2-11b2-8fda-c4db5fb666e0。
I figured out that the class ID of @mozilla.org/image/container;1 is 27f0682c-ff64-4dd2-ae7a-668e59f2fd38, not 5e04ec5e-1dd2-11b2-8fda-c4db5fb666e0 that I was wrongly using..