Xulrunner / JavaXPCOM - 如何创建imgIContainer的实例?

时间:2011-11-04 15:50:58

标签: xpcom xulrunner

我正在尝试创建这个答案的Java-XPCOM版本:

xul/xpcom copy image from string to clipboard

我可以通过下面列出的调用(剪贴板,io,transferable)来获取大多数服务/组件,但我不能对图像容器( 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数组,但没有运气..

imgIContainer imgContainer = (imgIContainer)org.mozilla.xpcom.Mozilla.getInstance().getComponentManager().createInstance("5e04ec5e-1dd2-11b2-8fda-c4db5fb666e0", null, imgIContainer.IMGICONTAINER_IID);

我的班级ID是错误的,还是我应该以完全不同的方式完成这一切?

谢谢

Pradyumna

1 个答案:

答案 0 :(得分:1)

我发现@ mozilla.org / image / container; 1的类ID是27f0682c-ff64-4dd2-ae7a-668e59f2fd38,而不是我错误使用的5e04ec5e-1dd2-11b2-8fda-c4db5fb666e0 .. < / p>