Search code examples
phpc++visual-studio-2012com

Is my COM object ready for PHP?


I have create simple COM object using ATL according to description in Creating COM using ATL in C++ from VS2012 and have registered in system using regsvr32.exe. But I'm not sure it is ready for scripting language like PHP. I'm trying to find my object using Power Shel script taken from script location

function Get-ComObject {

    param(
        [Parameter(Mandatory=$true,
        ParameterSetName='FilterByName')]
        [string]$Filter,

        [Parameter(Mandatory=$true,
        ParameterSetName='ListAllComObjects')]
        [switch]$ListAll
    )

    $ListofObjects = Get-ChildItem HKLM:\Software\Classes -ErrorAction SilentlyContinue | Where-Object {
        $_.PSChildName -match '^\w+\.\w+$' -and (Test-Path -Path "$($_.PSPath)\CLSID")
    } | Select-Object -ExpandProperty PSChildName

    if ($Filter) {
        $ListofObjects | Where-Object {$_ -like $Filter}
    } else {
        $ListofObjects
    }
}

And I can't find my ATLProject1.SomeObject class. What is missing in my project?


Solution

  • This script is not taking into account AppIDs in format Application.Object.Version.

    Replace -match '^\w+\.\w+$' with -match '^\w+\.\w+(?:\.\d+)?$'.