Well, I can't find what I want in the .NET docs.The Java docs indicate that if you set the application reference of a Generic Window, that it needs a reference to another Automation Object. So maybe you don't need the application window's handle after all. When I created a simple button to launch a GenericWindow, I got an error on the show method, but I also got a Generic Window.Add-in Code:
public class Button1 extends Button {
/**
* Called when the button is clicked.
*
* @exception java.io.IOException if there are interop problems.
* @exception com.esri.arcgis.interop.AutomationException if the component throws an ArcObjects exception.
*/
@Override
public void onClick() throws IOException, AutomationException {
// TODO Auto-generated method stub
GenericWindow genWindow = new GenericWindow();
genWindow.setApplicationByRef(app);
genWindow.setName("Window 1");
genWindow.setTitle("Generic Window Test");
genWindow.putPosition(100, 100, 500, 500);
genWindow.show(true);
}
@Override
public void init(IApplication app) throws IOException, AutomationException {
// TODO Auto-generated method stub
super.init(app);
this.app = app;
mxDoc = (IMxDocument) app.getDocument();
map = mxDoc.getActiveView().getFocusMap();
}
private IApplication app;
private IMxDocument mxDoc;
private IMap map;
}
Error message from log file:
INFO::Using the following arguments to create the JVM
-Djava.class.path=C:\Program Files (x86)\ArcGIS\Desktop10.0\\java\lib\arcobjects.jar
-Xms64m
-Xmx128m
-Xss512k
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8013
INFO::Successfully created an instance of : com/esri/arcgis/addinframework/AddInFactory
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
Caused by: AutomationException: 0x80004005 - Unspecified error
at com.esri.arcgis.arcmapui.GenericWindow.show(Unknown Source)
at Button1.onClick(Button1.java:27)
at com.esri.arcgis.addinframework.InternalButton.onClick(Unknown Source)
... 4 more
SEVERE::CAUSE
AutomationException: 0x80004005 - Unspecified error
at com.esri.arcgis.arcmapui.GenericWindow.show(Unknown Source)
at Button1.onClick(Button1.java:27)
at com.esri.arcgis.addinframework.InternalButton.onClick(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
GenericWindow Screenshot is attached.