I had a working .net dll exposed as a com object using the non unicode version of inno. It has been working for a long time and has not had any changes. I am trying to convert to the unicode version of inno, and ran into an issue where calling CreateOleObject now throws "The parameter is incorrect, ProgId: ***"
To recreate this issue...
Create a C# project named samplecom and mark the assembly as COM-Visible in the project properties/Assembly Information
Use the following code in the default Class1.cs file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace samplecom
{
[ComVisible(true)]
public class MyClass
{
[ComVisible(true)]
public string MyMethod()
{
return "Hello from COM dll";
}
}
}
Build the project and then from a DOS/command prompt as Administrator register the dll using RegAsm, Note: the following assumes you are in the same directory as the dll or the samplecom\bin\debug folder
c:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe samplecom.dll /tlb:samplecom.tlb /codebase
Then using the following script test using but the non unicode and unicode versions of inno
[Setup]
AppName=My Sample COM
AppVersion=1.0
DefaultDirName={pf}\samplecom
[Code]
Var
comObject: Variant;
function NextButtonClick(CurPage: Integer): Boolean;
var
hWnd: Integer;
begin
if CurPage = wpWelcome then begin
comObject := CreateOleObject('samplecom.MyClass');
log(comObject.MyMethod());
end;
Result := True;
end;
Here is output of ansi version of inno
[15:50:23.779] *** Setup started
[15:50:25.435] Setup version: Inno Setup version 5.5.8 (a)
[15:50:25.437] Original Setup EXE: C:\dev\innosandbox\Output\setup.exe
[15:50:25.439] Setup command line: /SL5="$82622,56832,56832,C:\dev\innosandbox\Output\setup.exe" /SPAWNWND=$92602 /NOTIFYWND=$1A2580 /DEBUGWND=$5310D8
[15:50:25.440] Windows version: 10.0.14393 (NT platform: Yes)
[15:50:25.441] 64-bit Windows: Yes
[15:50:25.443] Processor architecture: x64
[15:50:25.445] User privileges: Administrative
[15:50:25.446] 64-bit install mode: No
[15:50:25.450] Created temporary directory: C:\Users\Keith\AppData\Local\Temp\is-E13L9.tmp
[15:50:35.234] Hello from COM dll
Update: 3/9/2017
Here is a link to the project along with a copy of the inno script.
https://www.dropbox.com/s/nxkwtgm086dtokv/InnoCom.zip?dl=0
I am not sure if it is related or a different issue, but using vbscript/cscript I am able to load the COM object using 32bit vbscript/cscript but it fails to load using the 64bit vbscript/cscript
The test.vbs file
Dim objXL
Set objXL = WScript.CreateObject("InnoCom.Inno")