【问题标题】:Is my COM object ready for PHP?我的 COM 对象准备好使用 PHP 了吗?
【发布时间】:2016-01-17 18:14:01
【问题描述】:

我根据Creating COM using ATL in C++ from VS2012 中的描述使用ATL 创建了简单的COM 对象,并使用regsvr32.exe 在系统中注册。但我不确定它是否已准备好用于 PHP 等脚本语言。我正在尝试使用取自 script location 的 Power Shel 脚本查找我的对象

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
    }
}

我找不到我的 ATLProject1.SomeObject 类。我的项目中缺少什么?

【问题讨论】:

    标签: php c++ visual-studio-2012 com


    【解决方案1】:

    此脚本未考虑 Application.Object.Version 格式的 AppID。

    -match '^\w+\.\w+$' 替换为-match '^\w+\.\w+(?:\.\d+)?$'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 2012-08-29
      • 1970-01-01
      • 1970-01-01
      • 2012-09-16
      • 2015-04-01
      • 1970-01-01
      相关资源
      最近更新 更多