Open GoogleCodeExporter opened 9 years ago
I took a look at this out of curiosity since I thought I had remembered or
heard that
CoCreateInstance should work with .NET ActiveX Controls. I did a test by
creating a
simple Windows Form Control Library ActiveX Control and scripted a page for it
and it
seemed to work out fine.
To test unzip the attached file and build the AxWinFormTest.sln in the
AxWinFormTest
folder. It should register the dll during build but if you need to run
regasm.exe
AxWinFormTest.dll /codebase /tlb . After the file is built and registered add
the
{cfe7133b-fbcc-4d49-8cfb-0bcfae763184} classid or
AxWinFormTest.AxWinFormTestControl
progid to be allowable from npffax.dll. After all that is set up launch the
included
FormTest.html. You should see a button and a text box if it all worked out well.
This does not solve the Excel issue, but I believe the Excel failure is
something
different. From other testing I performed if you allow the
{00024500-0000-0000-C000-000000000046} classid or the "Excel.Application.XX"
progid
in npffax.dll and then use a page like the included ExcelTest.html you will get
different results depending on your Office version. In Office 2007 you will see
Excel
launch in the task manager then disappear and in Office 2003 Excel will spawn
but
then promptly crash. So it appears the object is getting created but for some
reason
it gets destroyed. The Event Viewer did not yield any helpful information and
adjusting the DCOM permissions did not seem to help either. If I have some free
time
I might try to create a test application that calls CoCreateInstance outside of
the
browser to see if that changes anything. However from my testing I really do
believe
that the Excel failure probably has little to do with it being a .NET object.
From my research I also did not find a lot of information about using the
Excel.Application object in a web page. It might help if I had a better example
of
how one would use the object in a real world situation. From the example for the
issue all it seems to do is spawn an Excel process and nothing else.
Thanks,
-Brent
Original comment by Booker.B...@gmail.com
on 13 Feb 2010 at 7:52
Attachments:
Thanks Brent.
I can give you an example about the way to use the Excel object:
try {
oExcel = new ActiveXObject("Excel.Application");
} catch(e) {
alert("Unable to use ActiveX!");
return false;
}
// create an empty Excel file
oExcel.Visible=true; // make it visible
var newWorkbook=oExcel.Workbooks.Add;
newWorkbook.WorkSheets(1).Activate;
oSheet=newWorkbook.WorkSheets(1);
// write something into the file
oSheet.Cells(1, 1).value = "Hello World!";
I've created a javascript library that makes it easier to manipulate the Excel
object. I want to share it with the world, but I first wanted to find a
solution for
the other browsers, like Firefox... I'm using it right now in an intranet where
everyone have to use IE!
If you need more information, let me know :-)
Original comment by jarod...@gmail.com
on 16 Feb 2010 at 1:16
Hi Brent,
I just tried the attached FormTest.html sample and got:
AxHost.TestAuthorization: returning True
AxHost.NPP_New: debug level set to 5
AxHost.verifyClsID: verified successfully
AxHost.setClsID: CLSID {cfe7133b-fbcc-4d49-8cfb-0bcfae763184} set
AxHost.verifyClsID: verified successfully
AxHost.setClsIDFromProgID: PROGID AxWinFormTest.AxWinFormTestControl resolved
and set
The requested lookup key was not found in any active activation context.
AxHost.CreateControl: failed to create site
AxHost.NPP_New: failed to create the control
AxHost.TestAuthorization: returning True
AxHost.NPP_New: debug level set to 5
AxHost.verifyClsID: verified successfully
AxHost.setClsID: CLSID {cfe7133b-fbcc-4d49-8cfb-0bcfae763184} set
AxHost.verifyClsID: verified successfully
AxHost.setClsIDFromProgID: PROGID AxWinFormTest.AxWinFormTestControl resolved
and set
The requested lookup key was not found in any active activation context.
AxHost.CreateControl: failed to create site
AxHost.NPP_New: failed to create the control
I did not see the textbox and the button. I'm using v1.1 with Firefox 3.6.3
My purpose in trying this is just to load a .Net Assembly using this plugin,
not just
Excel in particular.
I tried it with another assembly that works perfectly fine with Internet
Explorer and
got the following:
AxHost.TestAuthorization: returning True
AxHost.verifyClsID: verified successfully
AxHost.setClsIDFromProgID: PROGID AxRS.AxRS resolved and set
AxHost.verifyClsID: verified successfully
AxHost.setClsID: CLSID {c61ec9c4-2212-479c-96f7-5be1a8275b3a} set
AxHost.NPP_New: debug level set to 5
An attempt was made to reference a token that does not exist.
AxHost.CreateControl: failed to create site
AxHost.NPP_New: failed to create the control
AxHost.TestAuthorization: returning True
AxHost.verifyClsID: verified successfully
AxHost.setClsIDFromProgID: PROGID AxRS.AxRS resolved and set
AxHost.verifyClsID: verified successfully
AxHost.setClsID: CLSID {c61ec9c4-2212-479c-96f7-5be1a8275b3a} set
AxHost.NPP_New: debug level set to 5
An attempt was made to reference a token that does not exist.
AxHost.CreateControl: failed to create site
AxHost.NPP_New: failed to create the control
Original comment by allen.r....@gmail.com
on 7 Jun 2010 at 1:04
Original issue reported on code.google.com by
jarod...@gmail.com
on 25 Jan 2010 at 3:28